Hello,

I found the line of code which is responsible for the segfault. With the following patch, KiCad doesn't crash any more and dragging works. However, the GUI looks a bit funny because the selection is not cleared:

--- a/pcbnew/router/router_tool.cpp     2017-03-18 01:07:08.635185047 +0100
+++ b/pcbnew/router/router_tool.cpp     2017-03-18 01:09:54.667179894 +0100
@@ -795,7 +795,7 @@
     PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
     VIEW_CONTROLS* ctls = getViewControls();

-    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
+    //m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );

     Activate();

It is not a real bugfix, but it is a starting point.

What I did to find the line:

1.

Program received signal SIGSEGV, Segmentation fault.
0x00005555571885e0 in ?? ()
(gdb) list
165         * MacOSX requires it for file association.
166         * @see http://wiki.wxwidgets.org/WxMac-specific_topics
167         */
168 void MacOpenFile( const wxString& aFileName ) // overload wxApp virtual
169        {
170            Pgm().MacOpenFile( aFileName );
171        }
172    };
173
174    IMPLEMENT_APP( APP_SINGLE_TOP );
(gdb) bt
#0  0x00005555571885e0 in ?? ()
#1 0x00007fffe0dec5c2 in operator() (__args#0=..., this=0x5555571c3d40) at /usr/include/c++/4.9/functional:2439 #2 COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=93825022049600) at /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h:271 #3 0x00007ffff59aa75e in make_fcontext () from /usr/lib/x86_64-linux-gnu/libboost_context.so.1.55.0
#4  0x0000000000000000 in ?? ()

2.

(gdb) br /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h:271
Breakpoint 1 at 0x7fffe0dec5b9: file /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h, line 271.
(gdb) c
Continuing.
[Thread 0x7fffcd652700 (LWP 14757) exited]

Breakpoint 1, COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=93825019588768)
    at /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h:271
271            cor->m_retVal = cor->m_func( *( cor->m_args ) );
(gdb) c
Continuing.

Breakpoint 1, COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=93825019291056)
    at /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h:271
271            cor->m_retVal = cor->m_func( *( cor->m_args ) );
(gdb) c
Continuing.

Breakpoint 1, COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=93825011058528)
    at /home/hannes/kicad/kicad-4.0.5+dfsg1/include/tool/coroutine.h:271
271            cor->m_retVal = cor->m_func( *( cor->m_args ) );
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000555556f1d920 in ?? ()

3.

COROUTINE<int, TOOL_EVENT const&> is used in common/tool/tool_manager.cpp:545
Add:
tool_manager.cpp:551
std::cout << aEvent.Format() << std::endl;

4.

Output is now:
category: command  action: action cmd-str: common.Control.zoomFitScreen
category: message action: action cmd-str: pcbnew.InteractiveSelection.selected category: message action: action cmd-str: pcbnew.InteractiveSelection.selected
category: command  action: activate cmd-str: pcbnew.InteractiveEdit
category: command action: action cmd-str: pcbnew.InteractiveRouter.InlineDrag
category: command  action: action cmd-str: pcbnew.InteractiveSelection.Clear

Program received signal SIGSEGV, Segmentation fault.
0x0000555556824800 in ?? ()

5.

Avoided call of pcbnew.InteractiveSelection.Clear -> Still crashed
Avoided call of pcbnew.InteractiveRouter.InlineDrag -> No crash but no dragging

6.

Added some output after each line in ROUTER_TOOL::InlineDrag() to see where is the problem. After
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
no output was visible any more, so I commented this line out and there is no segfault any more.

Regards,
Hannes

Reply via email to