Crash when hovering over or clicking on MSW "Unicode control characters" menu items in any text field

Bug #1807022 reported by Aleksandr Sh on 2018-12-05
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
High
Unassigned

Bug Description

1. Open any dialog with a text field from EEschema or PCBnew.
2. Right click on the field
3.
Hover mouse over "Insert Unicode control character" then over "Show Unicode control characters"
or
Toggle "Show Unicode control characters" a couple of times
5. Crash

Application: kicad
Version: (6.0.0-rc1-dev-1322-g1858b7dca), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

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=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Jeff Young (jeyjey) on 2018-12-07
summary: - Crash when hovering over or clicking on Windows "Unicode control
- characters" menu items in any text field
+ Crash when hovering over or clicking on MSW "Unicode control characters"
+ menu items in any text field
Changed in kicad:
importance: Undecided → High
milestone: none → 5.1.0
Changed in kicad:
status: New → Triaged
Wayne Stambaugh (stambaughw) wrote :

I can make this fail every time without any effort at all. What I cannot seem to do is get a successful stack track not matter what I try. I've tried several time to run a debug version of kicad in gdb and when the error occurs, it system completely locks and even task manager isn't capable of closing the hung app. I can't even alt-tab between apps. I have to use task manager to reboot my system to use it after the crash. Would one of our other windows users see if they can get a reasonable stack trace?

I have no crash (W3, 32bits)

Aleksandr Sh (dsa-t) wrote :

If I try to add an Unicode character using this menu, I get this wxWidgets assert window.

Wayne Stambaugh (stambaughw) wrote :

@JP, I can get the 32 bit version of kicad to crash windows.

Application: kicad
Version: (6.0.0-rc1-dev-1359-g7ed1968f6), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.62.0 OpenSSL/1.1.1a (WinSSL) zlib/1.2.11 brotli/1.0.7 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.35.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.62.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_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Brian Piccioni (br0an) wrote :

This also happens on 5.0.2. If I run eeSchema (either from the KiCad front end or directly from Windows search) with a blank sheet, Enter Text (i.e Type T) right click and hover over Insert Unicode then away from Insert Unicode I get a crash/exit. An error dialog pops up for a brief instant before the program closes.

I can hover over Show Unicode to no effect.

If I just try insert a unicode character LRM I get the following error

../wxWidgets-3.0.4/src/msw/toplevel.cpp(1545): assert "m_menuDepth > 0 failed in DoSendMenuOpenCloseEvent(): No open Menus?
Do you want to stop the program?
You can also choose [Cancel] to suppress further warnings.

If I hit ESC (i.e. Cancel) I do not get the error again. Significantly, the program no longer crashes - as though suppressing warnings also stops the crashing.

Unless I've transcribed a detail incorrectly this is 100% repeatable.

I tested this on the binaries downloaded from KiCad-pcb.org

Application: eeschema
Version: (5.0.2)-1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

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=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Seth Hillbrand (sethh) wrote :

Any chance you can do a screen recording to get a capture of the fleeting dialog?

I'll try that!

I strongly suspect it is the same one I got when I insert the Unicode character as it sort of looked the same.

I'll see if I can find a screen recorder. Will reply asap.

-----Original Message-----
From: <email address hidden> <email address hidden> On Behalf Of Seth Hillbrand
Sent: January 9, 2019 8:29 PM
To: <email address hidden>
Subject: [Bug 1807022] Re: Crash when hovering over or clicking on MSW "Unicode control characters" menu items in any text field

Any chance you can do a screen recording to get a capture of the fleeting dialog?

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1807022

Title:
  Crash when hovering over or clicking on MSW "Unicode control
  characters" menu items in any text field

Status in KiCad:
  Triaged

Bug description:
  1. Open any dialog with a text field from EEschema or PCBnew.
  2. Right click on the field
  3.
  Hover mouse over "Insert Unicode control character" then over "Show Unicode control characters"
  or
  Toggle "Show Unicode control characters" a couple of times
  5. Crash

  Application: kicad
  Version: (6.0.0-rc1-dev-1322-g1858b7dca), release build
  Libraries:
      wxWidgets 3.0.4
      libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
  Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
  Build Info:
      wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
      Boost: 1.68.0
      OpenCASCADE Community Edition: 6.9.1
      Curl: 7.61.1
      Compiler: GCC 8.2.0 with C++ ABI 1013

  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=ON
      KICAD_USE_OCE=ON
      KICAD_USE_OCC=OFF
      KICAD_SPICE=ON

To manage notifications about this bug go to:
https://bugs.launchpad.net/kicad/+bug/1807022/+subscriptions

Brian Piccioni (br0an) wrote :

Damit. I saw it once again before I got the video capture working then I tried it a bunch of times and can't see the "flash" error. It did look a lot like the one I get when I try insert the character. I uploaded the video capture and will keep trying.

Brian Piccioni (br0an) wrote :

One other not is that I can hover from Insert Unicode character to the character and back again but as soon as I hover away from Insert Unicode Charter it crashes. I can hover to/from any of the other right-click menu items with no problem.

Brian Piccioni (br0an) wrote :

This is what happens if I insert a character then hit ESC when the error comes up

Brian Piccioni (br0an) wrote :

This is what happens if I insert a character then hit ESC when the error comes up

Brian Piccioni (br0an) wrote :

I downloaded and checked Kicad 4 and this problem does not happen.

I noticed that Kicad 5 is based on a more recent release of WxWidgets than Kicad 4 and theorized that the problem may be with WxWidgets and not Kicad per se since the common point is WxWidgets (various text related parts have the problem) and this is a new version of WxWdigets. Even though the code which produces the error is quite old it is called by newer parts of Wx.

I tried to build Kicad 5 with an older version of WxWidgets but unfortunately that doesn't work as there is a version compatibility error when, for example, eeSchema is run.

I just thought I'd document this thesis. If anybody can suggest a means to test the hypothesis for example by building with an older version of WxWidgets I'd appreciate it.

Wayne Stambaugh (stambaughw) wrote :

I also tried deriving DIALOG_LABEL_EDITOR from wxDialog directly in case something was broken in the base DIALOG_SHIM class from which all kicad dialogs are derived but that did not fix the issue. I also tried commenting out the wxEVT_CHAR_HOOK event thinking that we were somehow breaking lower level event handling but no luck. Does anyone have an msvc debug build that they could attempt to debug this? Using gdb with gcc builds completely locks up window requiring me to open the task manager and forcing a reboot. End task does not kill the running process.

Wayne Stambaugh (stambaughw) wrote :

I just discovered that this does not happen in every dialog text edit control. The text editor control in the common options panel does not crash. There may be more but this eliminates the wxWidgets version (I'm using 3.0.4) as an issue. It looks like it's something we are doing, I just haven't found the common denominator yet.

Brian Piccioni (br0an) wrote :

Wayne

Thanks for that. I wasn't aware there wasn't a unicode option in the edit control so I hadn't tried it. Yes it does seem to exclude WxWidgets.

Inserting the unicode character does not cause a hard crash so it might be a more manageable problem to solve. At a minimum, it is a serious bug. Best case it is a different facet of the same bug.

The fact I *always* get the aforementioned error

"../wxWidgets-3.0.4/src/msw/toplevel.cpp(1545): assert "m_menuDepth > 0 failed in DoSendMenuOpenCloseEvent(): No open Menus?
Do you want to stop the program?"

when I insert an unicode character is probably diagnostic. This should never happen.

I also get a hard crash when I navigate away from insert unicode character and I believe I have seen the error message flash at least a couple times doing that. After all, both are closing the list of unicode characters.

Back tracking from that point might provide a clue. (i.e. we know *why* that error occurs due to !popup and wxEVT_MENU_CLOSE being true). So we are trying to close without isPopup being in the proper state. In other words in wxTopLevelWindowMSW::HandleExitMenuLoop(WXWORD isPopup), isPopup is somehow in the wrong state.

I'd normally try to trace this back to figure out why isPopup is wrong or at least to be sure both hard and soft crashes are the same issue.

I don't know how to make a debug version of WxWidgets for MSW and use it for my Kicad build as I might be able to track back from there. Mind you that would mean learning how to use GDB from the command line but I've love to try.

Sorry for my "amateur hour" type approach. It has worked in the past for me. As a hardware guy I end to work back from the observed failure.

Wayne Stambaugh (stambaughw) wrote :

I think I inadvertently fixed this in commit https://git.launchpad.net/kicad/commit/?id=69d90a4e84c1c904c0d880d431a7aebfa991994d. I can no longer reproduce this crash on any of my builds except the build from the 5.0.2-2 installer from the kicad website. When the nightly builds become available with this fix, please test this and let me know if the issue is resolved.

Nick Østergaard (nickoe) wrote :

The nightly built is available in a couple of hours

Wayne Stambaugh (stambaughw) wrote :

Thanks for the feedback. I'm changing the status to fix committed. The status can always be changed back to triaged if the the problem reoccurs.

Changed in kicad:
status: Triaged → Fix Committed
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