Avoid calling handleScreenRemoved() recursively
In some cases where a nested event loop is run as a result of a screen being removed (for instance if it's called from primaryScreenChanged() or similar signals) and multiple screens were added to the system, then we could end up calling handleScreenRemoved() for the placeholder screen recursively. This would cause a crash if anyone actually used the QScreen pointer passed through the screenRemoved() signal. This makes sure we set the placeholder screen to null before calling handleScreenRemoved() so that we don't call it again if we happen to end up in the same function in a nested event loop. Pick-to: 6.5 6.8 6.9 Change-Id: I237946851ed4dce03fd53093baba102c9686be46 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
0f521a0337
commit
f646c1b30b
@ -621,9 +621,11 @@ void QWaylandDisplay::handleScreenInitialized(QWaylandScreen *screen)
|
||||
mScreens.append(screen);
|
||||
QWindowSystemInterface::handleScreenAdded(screen);
|
||||
if (mPlaceholderScreen) {
|
||||
QWindowSystemInterface::handleScreenRemoved(mPlaceholderScreen);
|
||||
// handleScreenRemoved deletes the platform screen
|
||||
QPlatformScreen *s = mPlaceholderScreen;
|
||||
mPlaceholderScreen = nullptr;
|
||||
QWindowSystemInterface::handleScreenRemoved(s);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user