Gui: solves #8939: timers are moved between non-QThreads

For more details see: https://github.com/FreeCAD/FreeCAD/issues/8939#issuecomment-1474888902
This commit is contained in:
wmayer
2023-03-18 17:11:20 +01:00
committed by abdullahtahiriyo
parent 13d175e891
commit 3ed781ce1e

View File

@@ -33,6 +33,7 @@
# include <QMenu>
# include <QMessageBox>
# include <QPixmap>
# include <QThread>
# include <QTimer>
# include <QToolTip>
# include <QVBoxLayout>
@@ -757,6 +758,12 @@ void TreeWidget::updateStatus(bool delay) {
}
void TreeWidget::_updateStatus(bool delay) {
// When running from a different thread Qt will raise a warning
// when trying to start the QTimer
if (Q_UNLIKELY(thread() != QThread::currentThread())) {
return;
}
if (!delay) {
if (!ChangedObjects.empty() || !NewObjects.empty())
onUpdateStatus();