QNX: Don't crash if we unplug the primary display.
The QPA plugin assumes in several places that we have at least one QScreen. Even if patching the plugin to support 0 screens, Qt itself crashes when dereferencing a null paint device while synching the backing store. Change-Id: I2ac504a447aff811d6c07ab857340a3433557cdc Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
3dc47622a4
commit
29a78d48d0
@ -42,6 +42,7 @@
|
||||
#include "qqnxscreeneventhandler.h"
|
||||
#include "qqnxintegration.h"
|
||||
#include "qqnxkeytranslator.h"
|
||||
#include "qqnxscreen.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGuiApplication>
|
||||
@ -487,11 +488,20 @@ void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event)
|
||||
m_qnxIntegration->createDisplay(nativeDisplay, false /* not primary, we assume */);
|
||||
}
|
||||
} else if (!isAttached) {
|
||||
// We never remove the primary display, the qpa plugin doesn't support that and it crashes.
|
||||
// To support it, this would be needed:
|
||||
// - Adjust all qnx qpa code which uses screens
|
||||
// - Make QWidgetBackingStore not dereference a null paint device
|
||||
// - Create platform resources ( QQnxWindow ) for all QWindow because they would be deleted
|
||||
// when you delete the screen
|
||||
|
||||
if (!screen->isPrimaryScreen()) {
|
||||
// libscreen display is deactivated, let's remove the QQnxScreen / QScreen
|
||||
qScreenEventDebug() << "removing display";
|
||||
m_qnxIntegration->removeDisplay(screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_qqnxscreeneventhandler.cpp"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user