Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved segmentation fault triggered in QKeyMapper::changeKeyboard()

    General and Desktop
    pyqt4 qt4.8 segfault
    2
    3
    1083
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Marc_Van_Daele last edited by

      From time to time, we get a segfault with a stacktrace similar to the one at the end of this message.
      All stacktraces seem to originate in QKeyMapper::changeKeyboard().
      The lower stack frames and the actual widget (QLineEdit in the example) differ between crashes.

      We are using PyQt (Qt4.8.2 and sip 4.13.3).
      We noted that, from Qt5.0.0 onwards, a large part of this QKeyMapper::changeKeyboard() function was commented out: an extra #if 0 was added as can be seen in the code snippet below

      void QKeyMapper::changeKeyboard()
      {
          instance()->d_func()->clearMappings();
      
          // ## TODO: Support KeyboardLayoutChange on QPA
      #if 0
          // inform all toplevel widgets of the change
          QEvent e(QEvent::KeyboardLayoutChange);
          QWidgetList list = QApplication::topLevelWidgets();
          for (int i = 0; i < list.size(); ++i) {
      	        QWidget *w = list.at(i);
      	        qt_sendSpontaneousEvent(w, &e);
          }
      #endif
      }
      

      Any ideas

      • why this extra #if 0 was added in Qt5
      • whether it is safe to also add this in (a local build of) Qt4.8
      • what this code was supposed to do in the first place?

      Thanks in advance,

      Marc
      PS: Below is an example of the stacktraces we get

      #0  0x00007fe60a5d8f6b in raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
      #1  <signal handler called>
      #2  sip_api_is_py_method (gil=0x7fff73c87d1c, pymc=0xfff3d8e "", sipSelf=0xfd54200, cname=0x0, mname=0x7fe5f1222ce4 "changeEvent")
          at /build/buildd-sip4_4.13.3-2-amd64-4XEr_m/sip4-4.13.3/siplib/siplib.c:7573
      #3  0x00007fe5f10300a9 in sipQLineEdit::changeEvent (this=0xfff3d50, a0=0x7fff73c88490) at sipQtGuipart5.cpp:43517
      #4  0x00007fe5f02211dc in QWidget::event (this=0xfff3d50, event=0x7fff73c88490) at kernel/qwidget.cpp:8752
      #5  0x00007fe5f05d9ac7 in QLineEdit::event (this=0xfff3d50, e=0x7fff73c88490) at widgets/qlineedit.cpp:1524
      #6  0x00007fe5f107466b in event (a0=0x7fff73c88490, this=0xfff3d50) at sipQtGuipart5.cpp:43589
      #7  sipQLineEdit::event (this=0xfff3d50, a0=0x7fff73c88490) at sipQtGuipart5.cpp:43581
      #8  0x00007fe5f01d170c in QApplicationPrivate::notify_helper (this=this@entry=0x7ddafe0, receiver=receiver@entry=0xfff3d50, e=e@entry=0x7fff73c88490) at kernel/qapplication.cpp:4556
      #9  0x00007fe5f01d5b8a in QApplication::notify (this=0x7ffedb0, receiver=0xfff3d50, e=0x7fff73c88490) at kernel/qapplication.cpp:4417
      #10 0x00007fe5f11fdc66 in notify (a1=0x7fff73c88490, a0=0xfff3d50, this=0x7ffedb0) at sipQtGuipart9.cpp:35916
      #11 sipQApplication::notify (this=0x7ffedb0, a0=0xfff3d50, a1=0x7fff73c88490) at sipQtGuipart9.cpp:35908
      #12 0x00007fe608dc5b5e in QCoreApplication::notifyInternal (this=0x7ffedb0, receiver=0xfff3d50, event=0x7fff73c88490) at kernel/qcoreapplication.cpp:915
      #13 0x00007fe5f02271c4 in QKeyMapper::changeKeyboard () at kernel/qkeymapper.cpp:99
      #14 0x00007fe5f024c3cd in QApplication::x11ProcessEvent (this=0x7ffedb0, event=0x7fff73c88a00) at kernel/qapplication_x11.cpp:3365
      
      1 Reply Last reply Reply Quote 0
      • VRonin
        VRonin last edited by

        can you show the content of sipQLineEdit::changeEvent?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply Reply Quote 0
        • M
          Marc_Van_Daele last edited by Marc_Van_Daele

          In the PyQt 4.9.4 code downoaded from https://sourceforge.net/projects/pyqt/files/PyQt4/ I find
          (Note that we are using 4.9.3 but I couldn't find the sources of that version)

          void sipQLineEdit::changeEvent(QEvent *a0)
          {
              sip_gilstate_t sipGILState;
              PyObject *sipMeth;
          
              sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[14],sipPySelf,NULL,sipName_changeEvent);
          
              if (!sipMeth)
              {
                  QLineEdit::changeEvent(a0);
                  return;
              }
          
              typedef void (*sipVH_QtCore_17)(sip_gilstate_t,PyObject *,QEvent *);
          
              ((sipVH_QtCore_17)(sipModuleAPI_QtGui_QtCore->em_virthandlers[17]))(sipGILState,sipMeth,a0);
          }
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post