Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-45045

SIGFPE in QQuickMenu

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • 6.2.5, 6.3.0 Beta3
    • 5.4.1
    • Quick: Controls 1
    • None
    • * Windows 7 x64
      * Qt 5.4.1
      * MinGW 4.9.1 32bits

      When calling Menu.popup() in QML, the process crash with SIGFPE.

      The issue comes from QtQuickMenu::popup() in qquickmenu.cpp:377 :

              if (mousePos.x() == int(qInf())) {
      

      The integer cast effectively emits the SIGFPE.

      This does not happens in standard cases. However, if for any reason the floating point unit control word has been changed previously the process may crash.

      I successfully prevented the crash by reseting the floating point control word to its original value just before calling Menu.popup(). Here is the function I used, if anyone want to test:

      void setFpu(unsigned short fpu)
      {
      	unsigned short var = fpu;
      	asm("fldcw -2(%ebp)");
      }
      

      A quick fix could be to replace the comparison by:

      mousePos.x() == std::numeric_limits<int>::min()
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            bterrier Benjamin Terrier
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: