eeschema assert when duplicating hierarchical sheet (lp:#1800796)

[Original report](https://bugs.launchpad.net/bugs/1800796) created by **eelik (eelik)**
```
I was trying to duplicate a hierarchical sheet box in the main level. I got
assert:

/usr/include/wx-3.0/wx/strvararg.h(456): assert "(argtype &
(wxFormatStringSpecifier<T>::value)) == argtype" failed in
wxArgNormalizer(): format specifier doesn't match argument type

This is repeatable. It's not possible to continue, the same dialog comes up
again immediately.


#0 __GI___poll() at /build/glibc-
itYbWN/glibc-2.26/sysdeps/unix/sysv/linux/poll.c:29
#1 ??() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 g_main_loop_run() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 gtk_dialog_run() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#4 wxGUIAppTraits::ShowAssertDialog(wxString const&)() at
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#5 ??() at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#6 wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*,
wchar_t const*, wchar_t const*)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#7 wxApp::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t
const*, wchar_t const*)() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#8 ??() at /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#9 wxOnAssert(char const*, int, char const*, char const*, char const*)() at
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#10 wxArgNormalizer<long>::wxArgNormalizer() at
/usr/include/wx-3.0/wx/strvararg.h:456
#11 wxArgNormalizerWchar<long>::wxArgNormalizerWchar() at
/usr/include/wx-3.0/wx/strvararg.h:476
#12 wxString::Format<long>() at /usr/include/wx-3.0/wx/string.h:2322
#13 SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing() at
/work/ohjelmointi/kicad/kicad/eeschema/sch_component.cpp:1144
#14 SCH_SCREEN::EnsureAlternateReferencesExist() at
/work/ohjelmointi/kicad/kicad/eeschema/sch_screen.cpp:710
#15 SCH_SCREENS::ClearAnnotationOfNewSheetPaths() at
/work/ohjelmointi/kicad/kicad/eeschema/sch_screen.cpp:1363
#16 SCH_EDIT_FRAME::DuplicateItemsInList() at
/work/ohjelmointi/kicad/kicad/eeschema/operations_on_items_lists.cpp:289
#17 SCH_EDIT_FRAME::HandleBlockEnd() at
/work/ohjelmointi/kicad/kicad/eeschema/block.cpp:248
#18 SCH_EDIT_FRAME::Process_Special_Functions() at
/work/ohjelmointi/kicad/kicad/eeschema/schedit.cpp:335
#19 wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#20 wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)() at
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#21 wxEvtHandler::TryHereOnly(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#22 EDA_BASE_FRAME::ProcessEvent() at
/work/ohjelmointi/kicad/kicad/common/eda_base_frame.cpp:173
#23 wxEvtHandler::DoTryChain(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#24 wxEvtHandler::ProcessEvent(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#25 wxWindowBase::TryAfter(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#26 wxScrollHelperEvtHandler::ProcessEvent(wxEvent&)() at
/usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#27 wxEvtHandler::SafelyProcessEvent(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#28 wxMenuBase::SendEvent(int, int)() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#29 ??() at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#30 g_closure_invoke() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#31 ??() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#32 g_signal_emit_valist() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#33 g_signal_emit() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#34 gtk_widget_activate() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#35 gtk_menu_shell_activate_item() at /usr/lib/x86_64-linux-
gnu/libgtk-x11-2.0.so.0
#36 ??() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#37 ??() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#38 g_closure_invoke() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#39 ??() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#40 g_signal_emit_valist() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#41 g_signal_emit() at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#42 ??() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#43 gtk_propagate_event() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#44 gtk_main_do_event() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#45 ??() at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#46 g_main_context_dispatch() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#47 ??() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 g_main_context_iteration() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 gtk_main_iteration() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#50 wxWindow::DoPopupMenu(wxMenu*, int, int)() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#51 wxWindowBase::PopupMenu(wxMenu*, int, int)() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#52 wxWindowBase::PopupMenu() at /usr/include/wx-3.0/wx/window.h:1216
#53 SCH_DRAW_PANEL::OnRightClick() at
/work/ohjelmointi/kicad/kicad/eeschema/sch_draw_panel.cpp:546
#54 SCH_DRAW_PANEL::OnMouseEvent() at
/work/ohjelmointi/kicad/kicad/eeschema/sch_draw_panel.cpp:309
#55 wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&,
wxEvtHandler*, wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#56 wxEvtHandler::SearchDynamicEventTable(wxEvent&)() at
/usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0
#57 wxEvtHandler::TryHereOnly(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#58 wxEvtHandler::ProcessEventLocally(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#59 wxEvtHandler::ProcessEvent(wxEvent&)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#60 wxEvtHandler::ProcessPendingEvents()() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#61 wxAppConsoleBase::ProcessPendingEvents()() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#62 wxApp::DoIdle()() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#63 ??() at /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0
#64 g_main_context_dispatch() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#65 ??() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#66 g_main_loop_run() at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#67 gtk_main() at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#68 wxGUIEventLoop::DoRun()() at /usr/lib/x86_64-linux-
gnu/libwx_gtk2u_core-3.0.so.0
#69 wxEventLoopBase::Run()() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#70 wxAppConsoleBase::MainLoop()() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#71 APP_KICAD::OnRun() at /work/ohjelmointi/kicad/kicad/kicad/kicad.cpp:256
#72 wxEntry(int&, wchar_t**)() at /usr/lib/x86_64-linux-
gnu/libwx_baseu-3.0.so.0
#73 main() at /work/ohjelmointi/kicad/kicad/kicad/kicad.cpp:287


Application: kicad
Version: (6.0.0-rc1-dev-1065-gde971df4c-dirty), debug build
Libraries:
    wxWidgets 3.0.3
Platform: Linux 4.13.0-46-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    Compiler: GCC 7.2.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_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=OFF
    KICAD_USE_OCE=OFF
    KICAD_USE_OCC=OFF
    KICAD_SPICE=OFF
```
Original tags: eeschema

Story points: 6.0