Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. My Qt application has "segmentation fault" when I try to type keyboard
Qt 6.12 LTS is out! See what's new in the release blog

My Qt application has "segmentation fault" when I try to type keyboard

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
4 Posts 2 Posters 1.7k Views
  • 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.
  • Z Offline
    Z Offline
    zhzhy
    wrote on last edited by
    #1

    Qt creator,Qt online installer,My personal Qt Application all can't be used now.
    If I open them ,it's Ok.If I use mouse to operate them,It's ok,they run smoothly.But if I hit even a shift or ctrl on the keyboard,they disappear suddenly with some "segmentation fault".
    What can I do?

    JonBJ 1 Reply Last reply
    0
    • Z zhzhy

      Qt creator,Qt online installer,My personal Qt Application all can't be used now.
      If I open them ,it's Ok.If I use mouse to operate them,It's ok,they run smoothly.But if I hit even a shift or ctrl on the keyboard,they disappear suddenly with some "segmentation fault".
      What can I do?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @zhzhy
      Start by running you application under debugger, make it crash, look at the stack trace for a possible clue.

      Z 1 Reply Last reply
      2
      • JonBJ JonB

        @zhzhy
        Start by running you application under debugger, make it crash, look at the stack trace for a possible clue.

        Z Offline
        Z Offline
        zhzhy
        wrote on last edited by
        #3
        //main.cpp
        #include<QApplication>
        #include<QLabel>
        #include<QPushButton>
        
        int main(int argc, char *argv[])
        {
          QApplication app(argc, argv);
          QLabel *label = new QLabel("hello");
          QPushButton *button = new QPushButton("終了");
        
          QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit()));
        
          label->show();
          button->show();
        
          return app.exec();
        }
        
        

        I write this to try.
        and this is the debug information after I run it.

            },
            "archlevel": 1,
            "className": "QIbusPlatformInputContextPlugin",
            "debug": false,
            "version": 394496
        }
        
        
        qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ibus")
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/platforminputcontexts" ...
        qt.core.library: "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt6.so" loaded library
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/styles" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/styles" ...
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessiblebridge" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessiblebridge" ...
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessible" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessible" ...
        
        

        and as soon as I type such as a on keyboard this small qt window disappear and the debug information become.

        
        ntexts/libfcitxplatforminputcontextplugin-qt6.so" loaded library
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/styles" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/styles" ...
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessiblebridge" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessiblebridge" ...
        qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessible" ...
        qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessible" ...
        段错误 (核心已转储)
        
        

        these chinese word mean "segmentation fault",I don't know why.

        Z 1 Reply Last reply
        0
        • Z zhzhy
          //main.cpp
          #include<QApplication>
          #include<QLabel>
          #include<QPushButton>
          
          int main(int argc, char *argv[])
          {
            QApplication app(argc, argv);
            QLabel *label = new QLabel("hello");
            QPushButton *button = new QPushButton("終了");
          
            QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit()));
          
            label->show();
            button->show();
          
            return app.exec();
          }
          
          

          I write this to try.
          and this is the debug information after I run it.

              },
              "archlevel": 1,
              "className": "QIbusPlatformInputContextPlugin",
              "debug": false,
              "version": 394496
          }
          
          
          qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ibus")
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/platforminputcontexts" ...
          qt.core.library: "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin-qt6.so" loaded library
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/styles" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/styles" ...
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessiblebridge" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessiblebridge" ...
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessible" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessible" ...
          
          

          and as soon as I type such as a on keyboard this small qt window disappear and the debug information become.

          
          ntexts/libfcitxplatforminputcontextplugin-qt6.so" loaded library
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/styles" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/styles" ...
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessiblebridge" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessiblebridge" ...
          qt.core.plugin.factoryloader: checking directory path "/media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/accessible" ...
          qt.core.plugin.factoryloader: checking directory path "/home/zhzhy/hello/accessible" ...
          段错误 (核心已转储)
          
          

          these chinese word mean "segmentation fault",I don't know why.

          Z Offline
          Z Offline
          zhzhy
          wrote on last edited by zhzhy
          #4

          @zhzhy I tried to gdb it.

          Thread 1 "hello" received signal SIGSEGV, Segmentation fault.
          get_entry_for_key_state (group=group@entry=0, key=<optimized out>, state=<optimized out>) at src/state.c:132
          132	        if (type->entries[i].mods.mods != 0 && type->entries[i].mods.mask == 0)
          (gdb) bt
          #0  get_entry_for_key_state (group=group@entry=0, key=<optimized out>, state=<optimized out>) at src/state.c:132
          #1  0x00007ffff615220c in xkb_state_key_get_level (state=state@entry=0x5555555c78f0, kc=kc@entry=65, layout=layout@entry=0) at src/state.c:157
          #2  0x00007ffff6152aef in xkb_state_key_get_syms (state=state@entry=0x5555555c78f0, kc=kc@entry=65, syms_out=syms_out@entry=0x7fffffffd680) at src/state.c:845
          #3  0x00007ffff61530de in xkb_state_key_get_one_sym (state=0x5555555c78f0, kc=65) at src/state.c:914
          #4  0x00007ffff2ab2535 in ?? () from /media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6
          #5  0x00007ffff2ab28e9 in ?? () from /media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6
          #6  0x00007ffff2a8b37d in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () from /media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6
          #7  0x00007ffff2a8bdf6 in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
             from /media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6
          #8  0x00007ffff2aaa2a3 in ?? () from /media/zhzhy/software/qqt/6.5.1/gcc_64/plugins/platforms/../../lib/libQt6XcbQpa.so.6
          #9  0x00007ffff3cd817d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
          #10 0x00007ffff3cd8400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
          #11 0x00007ffff3cd84a3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
          #12 0x00007ffff73c2caa in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/zhzhy/software/qqt/6.5.1/gcc_64/lib/libQt6Core.so.6
          #13 0x00007ffff7123d7b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /media/zhzhy/software/qqt/6.5.1/gcc_64/lib/libQt6Core.so.6
          #14 0x00007ffff71205ae in QCoreApplication::exec() () from /media/zhzhy/software/qqt/6.5.1/gcc_64/lib/libQt6Core.so.6
          #15 0x0000555555557342 in main ()
          
          

          I get it,I accidently do some thing wrong with libxkbcommon,and I reinstall it
          "sudo apt-get install --reinstall libxkbcommon0",everything is fine now.thank your help.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt
          • Unsolved