problem with QWebView::show()
Hi.
I have class inherited from QThread. I am using QWebPage in there, for my developers purpose, I getting QWebPage from QWebView, but when I am calling function QWebView::show(), my program is terminated with error:
Code:
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
N: /var/tmp/portage/x11-libs/libX11-1.5.0/work/libX11-1.5.0/src/xcb_io.c:178: dequeue_pending_request: Warunek zapewnienia `!xcb_xlib_unknown_req_in_deq' nie został spełniony.
The program has unexpectedly finished.
My header file:
Code:
...
#include <QThread>
#include <QtWebKit>
{
....
Q_OBJECT
public:
explicit myclass();
...
protected:
Logger *logger;
Settings *mySettings;
public slots:
void pageLoading() { loop.exec(); }
}
source file:
Code:
myclass::myclass()
{
logger = Logger::getInstance();
mySettings = Settings::getInstance();
QWebView *view = new QWebView();
logger->Info("Showing QWebView");
view->show();
myPage = view->page();
connect(myPage->networkAccessManager(), SIGNAL(finished(QNetworkReply*)), &loop, SLOT(quit()));
connect(myPage,SIGNAL(loadStarted()), this, SLOT(pageLoading()));
}
I deleted line with view->show(); and my program is working fine.
My class has type of abstract. I inherit her in dynamic library. Am I doing something wrong, or it's problem with libX11?
Re: problem with QWebView::show()
QWebView is a GUI component and should only be used from the GUI (main) thread.
You almost certainly don't need a thread here anyway.
Re: problem with QWebView::show()
I know that, I am creating QWebView and showing in main thread (it's in the constructor, not in run() function), and it's crashing anyway when I'm calling QWebView::show().
I need threads for other things.
Edit:
I changed public QThread to public QObject and it's still crashing with this same error
Re: problem with QWebView::show()
Which version of Qt are you using? Could you prepare a minimal compilable example reproducing your problem?
Re: problem with QWebView::show()
ok, sorry, I am doing this in another thread, but it's not this object, just object in 2 levels up.
so problem solved. thanks