pcbnew segfault when forming invalid polygon

Bug #1759024 reported by Seth Hillbrand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Critical
Maciej Suminski

Bug Description

While working on a separate issue, I encountered a segfault when moving a polygon point to overlap an existing point. It does not happen frequently. Maybe about 1:100 when selecting points and moving them to overlap and then re-moving them so that they no longer overlap.

If I click on the two overlapping points without dragging, it appears that they are merged. But just clicking and dragging the points over each other does not merge them, so I can move them independently.

To reproduce, create a 5-segment copper zone and move the 5th point over the 4th, fill, unfill, move the point again, wash, rinse, repeat. Wish I had a better procedure for this one.

Backtrace:
#0 0x00007fffcee3fe1c in POINT_EDITOR::OnSelectionChange (this=0x55555911fa50, aEvent=...)
    at /home/seth/code/kicad/kicad-launchpad/pcbnew/tools/point_editor.cpp:337
#1 0x00007fffcee4a488 in std::__invoke_impl<int, int (POINT_EDITOR::* const&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT const&> (__f=
    @0x555557de0010: (int (POINT_EDITOR::*)(POINT_EDITOR * const, const TOOL_EVENT &)) 0x7fffcee3f93e <POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>, __t=@0x555557de0020: 0x55555911fa50, __args#0=...)
    at /usr/include/c++/6/functional:227
#2 0x00007fffcee49fdd in std::__invoke<int (POINT_EDITOR::* const&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT const&> (__fn=
    @0x555557de0010: (int (POINT_EDITOR::*)(POINT_EDITOR * const, const TOOL_EVENT &)) 0x7fffcee3f93e <POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>, __args#0=@0x555557de0020: 0x55555911fa50, __args#1=...)
    at /usr/include/c++/6/functional:251
#3 0x00007fffcee49aaf in std::_Mem_fn_base<int (POINT_EDITOR::*)(TOOL_EVENT const&), true>::operator()<POINT_EDITOR*&, TOOL_EVENT const&> (this=0x555557de0010, __args#0=@0x555557de0020: 0x55555911fa50, __args#1=...)
    at /usr/include/c++/6/functional:604
#4 0x00007fffcee4935c in std::_Bind<std::_Mem_fn<int (POINT_EDITOR::*)(TOOL_EVENT const&)> (POINT_EDITOR*, std::_Placeholder<1>)>::__call<int, TOOL_EVENT const&, 0ul, 1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>) (
    this=0x555557de0010, __args=<unknown type in /usr/local/bin/_pcbnew.kiface, CU 0x360b96e, DIE 0x366d4ba>)
    at /usr/include/c++/6/functional:934
#5 0x00007fffcee48c50 in std::_Bind<std::_Mem_fn<int (POINT_EDITOR::*)(TOOL_EVENT const&)> (POINT_EDITOR*, std::_Placeholder<1>)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&) (this=0x555557de0010, __args#0=...)
    at /usr/include/c++/6/functional:993
#6 0x00007fffcee480e5 in std::_Function_handler<int (TOOL_EVENT const&), std::_Bind<std::_Mem_fn<int (POINT_EDITOR::*)(TOOL_EVENT const&)> (POINT_EDITOR*, std::_Placeholder<1>)> >::_M_invoke(std::_Any_data const&, TOOL_EVENT const&) (
    __functor=..., __args#0=...) at /usr/include/c++/6/functional:1717
#7 0x00007fffcf4ad4d3 in std::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const (
    this=0x5555590e5908, __args#0=...) at /usr/include/c++/6/functional:2127
#8 0x00007fffcf4aa33d in COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=140736610786112)
    at /home/seth/code/kicad/kicad-launchpad/include/tool/coroutine.h:329
#9 0x00007fffcf4fcda1 in make_fcontext () from /usr/local/bin/_pcbnew.kiface
#10 0x00005555586373a0 in ?? ()
#11 0x0000555557aec5a0 in ?? ()
#12 0x0000000000000000 in ?? ()

Application: kicad
Version: (5.0.0-rc2-dev-312-g347f6dadd), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 GnuTLS/3.5.8 zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-6-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

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

Tags: pcbnew
Changed in kicad:
status: New → Triaged
importance: Undecided → Critical
milestone: none → 5.0.0-rc2
assignee: nobody → Maciej Suminski (orsonmmz)
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 886dc48cc42aee6dea94364d5a9f12ceb8982d85
https://git.launchpad.net/kicad/patch/?id=886dc48cc42aee6dea94364d5a9f12ceb8982d85

Changed in kicad:
status: Triaged → Fix Committed
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have fixed the crash, but I still see some problems (zone corners disappearing) when one drags a vertex over another one and keeps refilling the zone. The new issue is not that critical, as it can be easily undone. I will try to fix it tomorrow.

Revision history for this message
Seth Hillbrand (sethh) wrote :

That was fast. Thanks, Orson!

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.