Scope exported/imported objects to the test

Summary:
m_imported was parented to the TestForeign class, which lasts for all
the tests. This caused an error on teardown.

Test Plan: Ran with ASAN. Finally everything passes!

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D9407
This commit is contained in:
David Edmundson 2017-12-19 15:56:10 +00:00
parent d67ce1e86c
commit e5631f0e7b

View file

@ -210,7 +210,7 @@ void TestForeign::doExport()
m_exportedSurfaceInterface = serverSurfaceCreated.first().first().value<KWayland::Server::SurfaceInterface*>();
//Export a window
m_exported = m_exporter->exportTopLevel(m_exportedSurface, this);
m_exported = m_exporter->exportTopLevel(m_exportedSurface, m_connection);
QVERIFY(m_exported->handle().isEmpty());
QSignalSpy doneSpy(m_exported.data(), &XdgExported::done);
QVERIFY(doneSpy.wait());
@ -220,7 +220,7 @@ void TestForeign::doExport()
QVERIFY(transientSpy.isValid());
//Import the just exported window
m_imported = m_importer->importTopLevel(m_exported->handle(), this);
m_imported = m_importer->importTopLevel(m_exported->handle(), m_connection);
QVERIFY(m_imported->isValid());
QSignalSpy childSurfaceInterfaceCreated(m_compositorInterface, SIGNAL(surfaceCreated(KWayland::Server::SurfaceInterface*)));
@ -327,7 +327,7 @@ void TestForeign::testExportTwoTimes()
doExport();
//Export second window
KWayland::Client::XdgExported *exported2 = m_exporter->exportTopLevel(m_exportedSurface, this);
KWayland::Client::XdgExported *exported2 = m_exporter->exportTopLevel(m_exportedSurface, m_connection);
QVERIFY(exported2->handle().isEmpty());
QSignalSpy doneSpy(exported2, &XdgExported::done);
QVERIFY(doneSpy.wait());
@ -337,7 +337,7 @@ void TestForeign::testExportTwoTimes()
QVERIFY(transientSpy.isValid());
//Import the just exported window
KWayland::Client::XdgImported *imported2 = m_importer->importTopLevel(exported2->handle(), this);
KWayland::Client::XdgImported *imported2 = m_importer->importTopLevel(exported2->handle(), m_connection);
QVERIFY(imported2->isValid());
//create a second child surface
@ -370,7 +370,7 @@ void TestForeign::testImportTwoTimes()
QVERIFY(transientSpy.isValid());
//Import another time the exported window
KWayland::Client::XdgImported *imported2 = m_importer->importTopLevel(m_exported->handle(), this);
KWayland::Client::XdgImported *imported2 = m_importer->importTopLevel(m_exported->handle(), m_connection);
QVERIFY(imported2->isValid());
//create a second child surface