mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
only connect when needed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35743 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cf570e0a8d
commit
9cfeaf4c0a
@ -22,17 +22,19 @@ namespace frontend {
|
||||
|
||||
IntoGuiThreadMover::IntoGuiThreadMover()
|
||||
{
|
||||
moveToThread(QApplication::instance()->thread());
|
||||
connect(this, SIGNAL(triggerCall()), this, SLOT(doFunctionCall()),
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
void IntoGuiThreadMover::callInGuiThread()
|
||||
{
|
||||
if (QThread::currentThread() == QApplication::instance()->thread()) {
|
||||
QThread* gui_thread = QApplication::instance()->thread();
|
||||
if (QThread::currentThread() == gui_thread) {
|
||||
synchronousFunctionCall();
|
||||
} else {
|
||||
moveToThread(gui_thread);
|
||||
connect(this, SIGNAL(triggerCall()), this, SLOT(doFunctionCall()),
|
||||
Qt::QueuedConnection);
|
||||
// TODO try with condition, it's maybe cheaper
|
||||
QEventLoop loop;
|
||||
connect(this, SIGNAL(called()), &loop, SLOT(quit()));
|
||||
Q_EMIT triggerCall();
|
||||
|
Loading…
Reference in New Issue
Block a user