Create pad array in footprint editor results in segmentation fault

Bug #1782855 reported by Carl on 2018-07-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Critical
Jeff Young

Bug Description

Attempting to create an array of pads in footprint editor results in a segmentation fault.

Application: kicad
Version: 6.0.0-rc1-unknown-da35b16~65~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-23-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.3.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Snippet from running with valgrind:

==21639== Process terminating with default action of signal 11 (SIGSEGV)
==21639== Access not within mapped region at address 0x19E1B6B92AD
==21639== at 0x698F646: __dynamic_cast (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25)
==21639== by 0x1CE98765: ??? (in /usr/bin/_pcbnew.kiface)
==21639== by 0x1C66E932: ??? (in /usr/bin/_pcbnew.kiface)
==21639== by 0x63D34BD: wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x63D38C9: wxEvtHandler::SearchDynamicEventTable(wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x63D395E: wxEvtHandler::TryHereOnly(wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x63D3A12: wxEvtHandler::ProcessEventLocally(wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x63D3A74: wxEvtHandler::ProcessEvent(wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x63D37D6: wxEvtHandler::SafelyProcessEvent(wxEvent&) (in /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0.4.0)
==21639== by 0x5BAACEE: wxTextEntryBase::SendTextUpdatedEvent(wxWindow*) (in /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0.4.0)
==21639== by 0x7DBAF6C: g_closure_invoke (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.1)
==21639== by 0x7DCDD3D: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.5600.1)

Seth Hillbrand (sethh) wrote :

@Jeff- I don't understand the Unit Binder work yet. It appears that you are casting aValue from wxWindow* to wxTextEntry*? I don't think that's allowed as wxTextEntry doesn't derive from wxWindow (http://docs.wxwidgets.org/3.1/classwx_text_entry.html)

But I see you made that change specifically. Can you explain the reasoning a bit?

Changed in kicad:
importance: Undecided → Critical
milestone: none → 5.1.0
status: New → Confirmed
Jeff Young (jeyjey) wrote :

@Seth, wxTextCtrl and wxComboBox (cf: http://docs.wxwidgets.org/3.1/classwx_text_ctrl.html) inherit from both and so can be dynamic_cast to either. Other types of wxWindows will return NULL from the dynamic_cast.

The UNIT_BINDER is just a composite construct which holds pointers to a label text, control, and units text, and allows them to be treated as one item. It handles unit conversions, eval, and some forms of validation automatically.

Jeff Young (jeyjey) wrote :

The trouble is that we're doing event processing during initialization. The initialization of the first UNIT_BINDER sends an event which results in updating one of the other UNIT_BINDERs (which hasn't been initialized yet).

Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Confirmed → In Progress
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 06ea7cdb79742f8cbdc846dd27e48b8e783a74bb
https://git.launchpad.net/kicad/patch/?id=06ea7cdb79742f8cbdc846dd27e48b8e783a74bb

Changed in kicad:
status: In Progress → Fix Committed
Jeff Young (jeyjey) wrote :

I went ahead and pushed a fix.

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

Other bug subscribers