Mir: Call QPlatformIntegration::destroyScreen() as recommended.
The QPA plugin was deleting the screen object manually, which is not needed or the recommended approach. The screen(s) are already maintained by QGuiApplication and destroying the screen object(s) should be done by calling QPlatformIntegration::destroyScreen(). This change removes the need to keep a reference to the screen(s) in the mir platform integration class, and removes the warning printed on exit. Change-Id: I61f37c25ebabf3e96e4cea458c4af454d025926a Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>bb10
parent
c09bc82f0a
commit
bf60b1636d
|
|
@ -110,8 +110,7 @@ QMirClientClientIntegration::QMirClientClientIntegration()
|
|||
mNativeInterface->setMirConnection(u_application_instance_get_mir_connection(mInstance));
|
||||
|
||||
// Create default screen.
|
||||
mScreen = new QMirClientScreen(u_application_instance_get_mir_connection(mInstance));
|
||||
screenAdded(mScreen);
|
||||
screenAdded(new QMirClientScreen(u_application_instance_get_mir_connection(mInstance)));
|
||||
|
||||
// Initialize input.
|
||||
if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) {
|
||||
|
|
@ -140,7 +139,8 @@ QMirClientClientIntegration::~QMirClientClientIntegration()
|
|||
{
|
||||
delete mInput;
|
||||
delete mInputContext;
|
||||
delete mScreen;
|
||||
for (QScreen *screen : QGuiApplication::screens())
|
||||
QPlatformIntegration::destroyScreen(screen->handle());
|
||||
delete mServices;
|
||||
}
|
||||
|
||||
|
|
@ -185,8 +185,13 @@ QPlatformWindow* QMirClientClientIntegration::createPlatformWindow(QWindow* wind
|
|||
|
||||
QPlatformWindow* QMirClientClientIntegration::createPlatformWindow(QWindow* window)
|
||||
{
|
||||
return new QMirClientWindow(window, mClipboard, static_cast<QMirClientScreen*>(mScreen),
|
||||
mInput, u_application_instance_get_mir_connection(mInstance));
|
||||
return new QMirClientWindow(window, mClipboard, screen(),
|
||||
mInput, u_application_instance_get_mir_connection(mInstance));
|
||||
}
|
||||
|
||||
QMirClientScreen *QMirClientClientIntegration::screen() const
|
||||
{
|
||||
return static_cast<QMirClientScreen *>(QGuiApplication::primaryScreen()->handle());
|
||||
}
|
||||
|
||||
bool QMirClientClientIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public:
|
|||
|
||||
QPlatformOpenGLContext* createPlatformOpenGLContext(QOpenGLContext* context);
|
||||
QPlatformWindow* createPlatformWindow(QWindow* window);
|
||||
QMirClientScreen* screen() const { return mScreen; }
|
||||
QMirClientScreen* screen() const;
|
||||
|
||||
private:
|
||||
void setupOptions();
|
||||
|
|
@ -85,7 +85,6 @@ private:
|
|||
|
||||
QMirClientPlatformServices* mServices;
|
||||
|
||||
QMirClientScreen* mScreen;
|
||||
QMirClientInput* mInput;
|
||||
QPlatformInputContext* mInputContext;
|
||||
QSharedPointer<QMirClientClipboard> mClipboard;
|
||||
|
|
|
|||
Loading…
Reference in New Issue