ext/embed/sunscraperthread.cpp in sunscraper-1.2.0.beta1 vs ext/embed/sunscraperthread.cpp in sunscraper-1.2.0.pre1
- old
+ new
@@ -1,14 +1,17 @@
#include <QApplication>
+#include <qnamespace.h>
#include <QtDebug>
#include "sunscraperthread.h"
#include "sunscraperworker.h"
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
pthread_t SunscraperThread::m_thread;
#endif
+extern void qt_set_current_thread_to_main_thread();
+
void SunscraperThread::invoke()
{
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
pthread_create(&m_thread, NULL, &SunscraperThread::thread_routine, NULL);
#endif
@@ -20,9 +23,11 @@
int argc = 1;
char *argv[] = { (char*) "Sunscraper", NULL};
/* Why (char*)? Because argv can (theoretically) be modified. *
* But Qt won't do that with argv[0]. I know, trust me. */
+
+ QInternal::callFunction(QInternal::SetCurrentThreadToMainThread, NULL);
QApplication app(argc, argv);
app.setApplicationName("Sunscraper-Embed");
SunscraperWorker::unlock();