History

Only change the menu visibility on the main thread

Ada committed 1 year ago

Commit 656b1d41 parent f5ea94e1 file · +5 −0Browse files

Showing the changes to interface/src/scripting/MenuScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/MenuScriptingInterface.cpp+5−0
@@ -220,6 +220,11 @@ void MenuScriptingInterface::triggerOption(const QString& menuOption) { · 219 unmodified lines
220220 }
221221
222222 void MenuScriptingInterface::setVisible(bool visible) {
223+ if (QThread::currentThread() != qApp->thread()) {
224+ QMetaObject::invokeMethod(this, "setVisible", Q_ARG(bool, visible));
225+ return;
226+ }
227+
223228 auto* menuBar = qApp->getWindow()->menuBar();
224229 bool wasVisible = menuBar->isVisible();
225230