forked from qt-creator/qt-creator
Use invokeMethod instead of single shot timer with 0 timeout
Refactor it in coreplugin. Change-Id: I6aaad1b9270a8ff8a4a0bea6a1fff806b2fe190b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "cppeditorconstants.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <cpptools/cpptoolssettings.h>
|
||||
@@ -142,10 +141,8 @@ static InfoBarEntry createMinimizableInfo(const Id &id,
|
||||
// The minimizer() might delete the "Minimize" button immediately and as
|
||||
// result invalid reads will happen in QToolButton::mouseReleaseEvent().
|
||||
// Avoid this by running the minimizer in the next event loop iteration.
|
||||
info.setCustomButtonInfo(MinimizableInfoBars::tr("Minimize"), [=](){
|
||||
QTimer::singleShot(0, [=] {
|
||||
minimizer();
|
||||
});
|
||||
info.setCustomButtonInfo(MinimizableInfoBars::tr("Minimize"), [minimizer] {
|
||||
QMetaObject::invokeMethod(settings(), [minimizer] { minimizer(); }, Qt::QueuedConnection);
|
||||
});
|
||||
|
||||
return info;
|
||||
|
||||
Reference in New Issue
Block a user