SIGSEGV when importing DXF in footprint editor

Bug #1384902 reported by Kaspar Bumke
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Unassigned
4.0
Fix Released
Critical
Unassigned
Product
Fix Released
Critical
Unassigned

Bug Description

Program received signal SIGSEGV, Segmentation fault.
0xa74ffa00 in EDA_ITEM::EDA_ITEM(EDA_ITEM const&) () from /usr/bin/_pcbnew.kiface

DXF file attached.

Version: 0.201409261646+5148~15~u i386 from the Ubuntu PPA on Ubuntu 14.04.

Revision history for this message
Kaspar Bumke (kaspar-bumke) wrote :
Revision history for this message
Kaspar Bumke (kaspar-bumke) wrote :
Revision history for this message
Blair Bonnett (bcb) wrote :

Can confirm this happens on Arch with revision 5211.

Changed in kicad:
status: New → Confirmed
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Just to be sure - does it happen only when you opened the module editor with no footprint loaded? Do you select "New footprint" from menu or toolbar?

Revision history for this message
Kaspar Bumke (kaspar-bumke) wrote : Re: [Bug 1384902] Re: SIGSEGV when importing DXF in footprint editor

Yes, it seems to only happen when no footprint is loaded.

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

When there is no footprint loaded, then there should be no possibility to place any kind of items. I have blocked DXF import unless there is a valid footprint (including a new empty one). Thank you for noting.

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Eldar Khayrullin (eldar) wrote :

Application: pcbnew
Version: (2015-09-12 BZR 6188, Git ca1ae0d)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-28-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.55.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Bug is present

Changed in kicad:
status: Fix Committed → New
importance: Undecided → Critical
Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maybe need do insensible also other menu entries that make no sense

Revision history for this message
Marco Hess (marco-hess) wrote :

2 points:

1) I don't see any crashes in Windows BZR 6185 when loading the grid.dxf file as a silk screen layer.

2) The grid.dxf file appears to be invalid with respect to supported KiCad features on the import.
     See the updated section in the pcbnew manual re. DXF import for board outlines:

     https://github.com/KiCad/kicad-doc/blob/master/src/Pcbnew/Pcbnew_create_and_modify_board.adoc

     A properly converted grid.dxf grows about 10 fold but then imports correctly
    (again as a silkscreen. Did not test other layers).

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Hi Eldar,

I also could not reproduce the crash in Linux, revision 6188. If there are problems with a certain file, would you attach it to the bug report?

> Maybe need do insensible also other menu entries that make no sense

Could you give some more details?

Regards,
Orson

Revision history for this message
Blair Bonnett (bcb) wrote :

* When I open the footprint editor, before creating or opening a footprint, the 'Import DXF File' menu entry is not available for me.
* After starting a footprint, I can import the DXF file without any crash. Can't comment on its validity as I have no idea what is supported, or what it should look like, but a shape imports and can be placed without crashing.

What *exactly* are you doing to trigger this crash? Is the menu entry still available for you, or is this started from somewhere else? Are you using a translation?

Application: pcbnew
Version: 4.0.0-rc1-stable release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1009,GCC 5.2.0,wx containers,compatible with 2.8)
Platform: Linux 4.1.6-1-ARCH x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.58.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Import DXF available with no exist footprint. After click to canvas segfault is appear.
DXF file is valid because it is imported with pcbnew (I can't to share the file)

Revision history for this message
Eldar Khayrullin (eldar) wrote :

I use standard english GUI.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

(gdb) bt
#0 0x00007ffff5b65267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff5b66eca in __GI_abort () at abort.c:89
#2 0x00007ffff5b5e03d in __assert_fail_base (
    fmt=0x7ffff7eee5fc "%s%s%s:%u: %s%sПроверочное утверждение «%s» не выполнено.\n%n",
    assertion=assertion@entry=0x7fffe9cb4131 "m_board->m_Modules",
    file=file@entry=0x7fffe9cb4058 "/home/eldar/Dev/BUILD/kicad/kicad-source-mirror/pcbnew/tools/drawing_tool.cpp", line=line@entry=511,
    function=function@entry=0x7fffe9cb48a0 <DRAWING_TOOL::PlaceDXF(TOOL_EVENT const&)::__PRETTY_FUNCTION__> "int DRAWING_TOOL::PlaceDXF(const TOOL_EVENT&)") at assert.c:92
#3 0x00007ffff5b5e0f2 in __GI___assert_fail (assertion=0x7fffe9cb4131 "m_board->m_Modules",
    file=0x7fffe9cb4058 "/home/eldar/Dev/BUILD/kicad/kicad-source-mirror/pcbnew/tools/drawing_tool.cpp", line=511,
    function=0x7fffe9cb48a0 <DRAWING_TOOL::PlaceDXF(TOOL_EVENT const&)::__PRETTY_FUNCTION__> "int DRAWING_TOOL::PlaceDXF(const TOOL_EVENT&)")
    at assert.c:101
#4 0x00007fffe94bdc5e in DRAWING_TOOL::PlaceDXF (this=0x44807c0, aEvent=...)
    at /home/eldar/Dev/BUILD/kicad/kicad-source-mirror/pcbnew/tools/drawing_tool.cpp:511
#5 0x00007fffe9ac2c18 in DELEGATE<int, TOOL_EVENT const&>::operator() (this=0x4689390, aA=...)
    at /home/eldar/Dev/BUILD/kicad/kicad-source-mirror/include/tool/delegate.h:58
#6 0x00007fffe9abf4c4 in COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=73962384)
    at /home/eldar/Dev/BUILD/kicad/kicad-source-mirror/include/tool/coroutine.h:217
#7 0x00007fffe3dfe71e in make_fcontext () from /usr/lib/x86_64-linux-gnu/libboost_context.so.1.55.0
#8 0x0000000000000001 in ?? ()
#9 0x00007fffe985b85a in ?? () from /home/eldar/Dev/BUILD/kicad/kicad-source-mirror/Build/pcbnew/_pcbnew.kiface
#10 0x0000000000000000 in ?? ()

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Steps for reproduce:
start kicad or standalone pcbnew, run FP editor, click menu File->Import DXF File, select dxf file, click Ok -> contour of DXF file is drawing on canvas, after click -> segfault.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Perhaps your pcbnew version is too old.
Import DXF ( and other options) is disabled when there is no footprint currently edited in my last Pcbnew version.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

"Perhaps your pcbnew version is too old."
Perhaps this is an issue specific to your platform, if you confirm the version is BZR 6188.
Import DXF ( and other options) must be disabled, or there is a bug specific to your platform.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

My build from https://github.com/KiCad/kicad-source-mirror:
Application: pcbnew
Version: (2015-09-12 BZR 6188, Git ca1ae0d)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-28-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.55.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

And same behaviour for https://code.launchpad.net/~js-reynaud/+archive/ubuntu/ppa-kicad:
Application: kicad
Version: 0.201509121501+6184~30~ubuntu15.04.1-product release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-28-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.55.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Eldar Khayrullin (eldar) wrote :

OS Ubuntu 15.04

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I do not have this option enabled when there is no footprint loaded, neither in project nor standalone mode.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Who have Ubuntu (preferably ver. 15.04) please check it

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Menu entries looks disabled If disable global menu :
env UBUNTU_MENUPROXY= pcbnew

Revision history for this message
Eldar Khayrullin (eldar) wrote :

And I noticed that in other kicad programs (eeschema, lib editor and etc) have same issue.
Strange: entry Save current Library As... is disable by default.
Maybe strange (good) entry dinamicaly is disabled after show widget?
And not good entries disabled before show widget or vice versa.
Ps: Maybe importance order of show widget and disable widget?!

Revision history for this message
jean-pierre charras (jp-charras) wrote :

It happens also on Ubuntu 14.10, with Unity.

Reason: for items in global menu, the wxUpdateUIEvent is never sent, even when the global menu is displayed.
Therefore, if a submenu is disabled/enabled only by the wxUpdateUIEvent corresponding to its own menu ID, it will be never disabled/enabled)
Of course, if a submenu is disabled/enabled by the wxUpdateUIEvent code corresponding to a tool ID (for instance a tool in a toolbar, it will be disabled/enabled.

Unity creates really many specific issues, which look like bugs in the WM.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maybe need at least check existing of footprint and then to show or don't to show corresponding dialog.
For example: eesch lib editor shows message box with text "No component"

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Application: pcbnew
Version: (2015-09-13 BZR 6189, Git 8193a89)-product debug build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-28-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.55.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Bug is present

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Patch for fixing the bug

Revision history for this message
Eldar Khayrullin (eldar) wrote :
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Does this mean we have to fix this everywhere wxEVT_UPDATE_UI is used? If so, maybe we should use the wxSetEnv(wxT("UBUNTU_MENUPROXY"), wxT("0")); solution provided in the wx bug tracker.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Yes, it mean we have to fix this everywhere wxEVT_UPDATE_UI is used.
I am afraid we should use the wxSetEnv(wxT("UBUNTU_MENUPROXY"), wxT("0")); solution, because I found an other issue when UBUNTU_MENUPROXY is not set, or set to 1:
If the footprint editor is run from Kicad (without the board editor) and if the Legacy mode is used at start, after switching to the GAL mode the main menu is no more shown.
When UBUNTU_MENUPROXY is set to 0, I did not see these issues.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

On 9/13/2015 1:14 PM, jean-pierre charras wrote:
> Yes, it mean we have to fix this everywhere wxEVT_UPDATE_UI is used.
> I am afraid we should use the wxSetEnv(wxT("UBUNTU_MENUPROXY"), wxT("0")); solution, because I found an other issue when UBUNTU_MENUPROXY is not set, or set to 1:
> If the footprint editor is run from Kicad (without the board editor) and if the Legacy mode is used at start, after switching to the GAL mode the main menu is no more shown.
> When UBUNTU_MENUPROXY is set to 0, I did not see these issues.
>
If this is the case, you should probably change your last commit to an
assertion and implement the environment variable solution. I don't have
Ubuntu so I have no way of testing the fix. Some how we will have to
test if the WM is Unity and set it accordingly. It will be an ugly hack
because it has to be set before GTK+ is initialized which means this
code will have to live the wxApp constructor. Hopefully this is only
temporary until either Canonical or the wxWidgets devs fix this issue.
Did you try wxWidgets trunk to see if this issue was fixed yet?

Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.