Solved qt application crash.
-
hi everyone,
i am getting below error, dont know how to figure out what exactly goin wrong.[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
sps_v1: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
The program has unexpectedly finished.thanx in advance.
P.S. edit : also getting
QPixmap: It is not safe to use pixmaps outside the GUI thread -
Hi
you should provide more details about OS version/platform
and Qt version,
when error happens.Also try it on other computer.
-
I suspect you're using the GUI classes from different threads. Please provide code to confirm or deny this.
-
@mrjj @kshegunov Thanks for reply.
result of command : lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trustyQt version : 4.8.6
@kshegunov : i cant provide code, its big application.
I am having scanner class which continuously running in thread and detecting scanner available or not and emit the signal when scanning event happen. further i used this signal to various slot as per need.
I create one more class to monitor all USB devices including scanner which are connected.
error occurred when specifically scanner not connected.I am very thankful if you suggest me correct approach to monitor all usb connection status. so that any thread wont get affected.
-
meanwhile tried with flag Qt::AA_X11InitThreads. but nothing works
for now i add below lines in .pro fileQMAKE_CXXFLAGS += -std=c++0x -pthread LIBS += -pthread
and add libraires in main.cpp and simply called XInitThreads();
but after calling function XInitThreads().
my application crash when i tried to call qmessagebox from some function.#include <thread> #include <X11/Xlib.h> Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); XInitThreads(); // if coment - `!xcb_xlib_threads_sequence_lost' failed. appeared. // app->setAttribute(Qt::AA_X11InitThreads, true); // setting flag has no effect so far QmlApplicationViewer viewer; ... ... } // test.cpp someFunction() { ... QMessageBox *msgBox = new QMessageBox(); int retValue=msgBox->exec(); // crash here. ... }
-
Hi everyone,
I read about Qt::AA_X11InitThreads and it clearly mention as "Calls XInitThreads() as part of the QApplication construction in order to make Xlib calls thread-safe. This attribute must be set before QApplication is constructed."
now I removed these flags from .pro file
QMAKE_CXXFLAGS += -std=c++0x -pthread LIBS += -pthread
and updated main.cpp file
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_X11InitThreads); QScopedPointer<QApplication> app(createApplication(argc, argv)); // XInitThreads(); // app->setAttribute(Qt::AA_X11InitThreads, true); QmlApplicationViewer viewer; ... }
Problem is fixed so far. thanks.