forked from qt-creator/qt-creator
Android: Fix a possible crash after reloading packages
The AndroidSdkManager::packagesReloaded() signal emission will trigger the connected slots in this order: 1. AndroidSettingsWidget::showEvent()'s lambda 2. AndroidSdkModel::refreshData() However, the 1st slot may execute the nested event loop which will cause the other GUI parts to be repainted. Since AndroidSdkModel wasn't notified yet about the packagesReloaded(), it still holds the data to the already deleted packages. The repaint will lead to reading the data from already deleted objects. The fix is to ensure the order of called slots is opposite, by queueing a call to AndroidSettingsWidget::showEvent()'s lambda. Change-Id: I090f0a44c3785a711a08f0eb985e2025cf3a923a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -520,7 +520,10 @@ void AndroidSettingsWidget::showEvent(QShowEvent *event)
|
||||
m_androidSummary->setInProgressText("Packages reloaded");
|
||||
m_sdkLocationPathChooser->triggerChanged();
|
||||
validateSdk();
|
||||
});
|
||||
}, Qt::QueuedConnection); // Hack: Let AndroidSdkModel::refreshData() be called first,
|
||||
// otherwise the nested loop inside validateSdk() may trigger
|
||||
// the repaint for the old data, containing pointers
|
||||
// to the deleted packages. That's why we queue the signal.
|
||||
});
|
||||
validateOpenSsl();
|
||||
m_isInitialReloadDone = true;
|
||||
|
Reference in New Issue
Block a user