eeschema crash when deleting a sheet pin (lp:#1827890)

[Original report](https://bugs.launchpad.net/bugs/1827890) created by **Martin Thomas (mtlaunchpad)**
```
When I delete a hirachical label, kicad crashes.
When I try to move it, it dissapears.



(gdb) r
Starting program: /usr/local/bin/kicad
^[[3~[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

(kicad:27779): Gtk-WARNING **: Im Modulpfad »adwaita« konnte keine Themen-
Engine gefunden werden,

(kicad:27779): Gtk-WARNING **: Im Modulpfad »adwaita« konnte keine Themen-
Engine gefunden werden,
[New Thread 0x7fffe2e02700 (LWP 27783)]
[New Thread 0x7fffe2601700 (LWP 27784)]
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
LoadAllLibraries: lib_names:
 cbb-nnoe-cache
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
[New Thread 0x7fffd9319700 (LWP 27801)]
[New Thread 0x7fffd8b18700 (LWP 27802)]

...

[Thread 0x7fffd8b18700 (LWP 27807) exited]
[Thread 0x7fffcffff700 (LWP 27806) exited]
[Thread 0x7fffcf7fe700 (LWP 27805) exited]
16:19:14: Debug: Disabling glCopyBuffer() on intel GPU

[Thread 0x7fffe2601700 (LWP 27784) exited]

Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007ffff3fc3960 in __dynamic_cast () from /usr/lib/x86_64-linux-
gnu/libstdc++.so.6
(gdb) backtrace
#0  0x00007ffff3fc3960 in __dynamic_cast () from /usr/lib/x86_64-linux-
gnu/libstdc++.so.6
#1  0x00007fffe0fa5ca5 in SCH_EDIT_TOOL::DoDelete (this=0x5555580b1d10,
aEvent=...)
    at /home/mthomas/daten/git/kicad/kicad-source-
mirror/eeschema/tools/sch_edit_tool.cpp:934
#2  0x00007fffe0fb2c2e in std::__invoke_impl<int, int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (
    __f=
   @ 0x555559ba2d20: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffe0fa5a64 <SCH_EDIT_TOOL::DoDelete(TOOL_EVENT const&)>,
__t=@0x555559ba2d30: 0x5555580b1d10, __args#0=...) at
/usr/include/c++/6/functional:227
#3  0x00007fffe0fb2897 in std::__invoke<int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (__fn=
   @ 0x555559ba2d20: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffe0fa5a64 <SCH_EDIT_TOOL::DoDelete(TOOL_EVENT const&)>,
__args#0=@0x555559ba2d30: 0x5555580b1d10, __args#1=...) at
/usr/include/c++/6/functional:251
#4  0x00007fffe0fb23ff in std::_Mem_fn_base<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&), true>::operator()<SCH_EDIT_TOOL*&,
TOOL_EVENT const&> (this=0x555559ba2d20, __args#0=@0x555559ba2d30:
0x5555580b1d10, __args#1=...) at /usr/include/c++/6/functional:604
#5  0x00007fffe0fb1955 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::__call<int, TOOL_EVENT const&, 0ul,
1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>)
(this=0x555559ba2d20,
    __args=<unknown type in /usr/local/bin/_eeschema.kiface, CU 0x2c96d28,
DIE 0x2cf43f7>) at /usr/include/c++/6/functional:934
#6  0x00007fffe0fb0819 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT
const&) (this=0x555559ba2d20, __args#0=...) at
/usr/include/c++/6/functional:993
#7  0x00007fffe0fafc36 in std::_Function_handler<int (TOOL_EVENT const&),
std::_Bind<std::_Mem_fn<int (SCH_EDIT_TOOL::*)(TOOL_EVENT const&)>
(SCH_EDIT_TOOL*, std::_Placeholder<1>)> >::_M_invoke(std::_Any_data const&,
TOOL_EVENT const&) (__functor=..., __args#0=...)
    at /usr/include/c++/6/functional:1717
#8  0x00007fffe116ff17 in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x555555c92e88,
__args#0=...)
    at /usr/include/c++/6/functional:2127
#9  0x00007fffe116cd95 in COROUTINE<int, TOOL_EVENT const&>::callerStub
(aData=140737488338992)
    at /home/mthomas/daten/git/kicad/kicad-source-
mirror/include/tool/coroutine.h:331
#10 0x00007fffe11cefc1 in make_fcontext () from
/usr/local/bin/_eeschema.kiface
#11 0x0000000000000000 in ?? ()



(gdb) r
Starting program: /usr/local/bin/kicad
^[[3~[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

(kicad:27779): Gtk-WARNING **: Im Modulpfad »adwaita« konnte keine Themen-
Engine gefunden werden,

(kicad:27779): Gtk-WARNING **: Im Modulpfad »adwaita« konnte keine Themen-
Engine gefunden werden,
[New Thread 0x7fffe2e02700 (LWP 27783)]
[New Thread 0x7fffe2601700 (LWP 27784)]
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
LoadAllLibraries: lib_names:
 cbb-nnoe-cache
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
/home/mthomas/daten/git/kicad/kicad-source-
mirror/common/tool/action_manager.cpp(219): assert "Assert failure" failed
in UpdateHotKeys(): Duplicate hotkey definitions for <unknown>:
eeschema.InteractiveEdit.duplicate and
eeschema.InspectionTool.showDatasheet
[New Thread 0x7fffd9319700 (LWP 27801)]
[New Thread 0x7fffd8b18700 (LWP 27802)]

...

[Thread 0x7fffd8b18700 (LWP 27807) exited]
[Thread 0x7fffcffff700 (LWP 27806) exited]
[Thread 0x7fffcf7fe700 (LWP 27805) exited]
16:19:14: Debug: Disabling glCopyBuffer() on intel GPU

[Thread 0x7fffe2601700 (LWP 27784) exited]

Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007ffff3fc3960 in __dynamic_cast () from /usr/lib/x86_64-linux-
gnu/libstdc++.so.6
(gdb) backtrace
#0  0x00007ffff3fc3960 in __dynamic_cast () from /usr/lib/x86_64-linux-
gnu/libstdc++.so.6
#1  0x00007fffe0fa5ca5 in SCH_EDIT_TOOL::DoDelete (this=0x5555580b1d10,
aEvent=...)
    at /home/mthomas/daten/git/kicad/kicad-source-
mirror/eeschema/tools/sch_edit_tool.cpp:934
#2  0x00007fffe0fb2c2e in std::__invoke_impl<int, int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (
    __f=
   @ 0x555559ba2d20: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffe0fa5a64 <SCH_EDIT_TOOL::DoDelete(TOOL_EVENT const&)>,
__t=@0x555559ba2d30: 0x5555580b1d10, __args#0=...) at
/usr/include/c++/6/functional:227
#3  0x00007fffe0fb2897 in std::__invoke<int (SCH_EDIT_TOOL::*
const&)(TOOL_EVENT const&), SCH_EDIT_TOOL*&, TOOL_EVENT const&> (__fn=
   @ 0x555559ba2d20: (int (SCH_EDIT_TOOL::*)(SCH_EDIT_TOOL * const, const
TOOL_EVENT &)) 0x7fffe0fa5a64 <SCH_EDIT_TOOL::DoDelete(TOOL_EVENT const&)>,
__args#0=@0x555559ba2d30: 0x5555580b1d10, __args#1=...) at
/usr/include/c++/6/functional:251
#4  0x00007fffe0fb23ff in std::_Mem_fn_base<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&), true>::operator()<SCH_EDIT_TOOL*&,
TOOL_EVENT const&> (this=0x555559ba2d20, __args#0=@0x555559ba2d30:
0x5555580b1d10, __args#1=...) at /usr/include/c++/6/functional:604
#5  0x00007fffe0fb1955 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::__call<int, TOOL_EVENT const&, 0ul,
1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>)
(this=0x555559ba2d20,
    __args=<unknown type in /usr/local/bin/_eeschema.kiface, CU 0x2c96d28,
DIE 0x2cf43f7>) at /usr/include/c++/6/functional:934
#6  0x00007fffe0fb0819 in std::_Bind<std::_Mem_fn<int
(SCH_EDIT_TOOL::*)(TOOL_EVENT const&)> (SCH_EDIT_TOOL*,
std::_Placeholder<1>)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT
const&) (this=0x555559ba2d20, __args#0=...) at
/usr/include/c++/6/functional:993
#7  0x00007fffe0fafc36 in std::_Function_handler<int (TOOL_EVENT const&),
std::_Bind<std::_Mem_fn<int (SCH_EDIT_TOOL::*)(TOOL_EVENT const&)>
(SCH_EDIT_TOOL*, std::_Placeholder<1>)> >::_M_invoke(std::_Any_data const&,
TOOL_EVENT const&) (__functor=..., __args#0=...)
    at /usr/include/c++/6/functional:1717
#8  0x00007fffe116ff17 in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x555555c92e88,
__args#0=...)
    at /usr/include/c++/6/functional:2127
#9  0x00007fffe116cd95 in COROUTINE<int, TOOL_EVENT const&>::callerStub
(aData=140737488338992)
    at /home/mthomas/daten/git/kicad/kicad-source-
mirror/include/tool/coroutine.h:331
#10 0x00007fffe11cefc1 in make_fcontext () from
/usr/local/bin/_eeschema.kiface
#11 0x0000000000000000 in ?? ()
```
Original tags: eeschema

Story points: 6.0