[plugins/qpa] Properly clean up the created KWayland::Client::Outputs

On build.kde.org the autotests started to crash on tear down due to a
newer Wayland library. The reason is that the KWayland::Client::Outputs
are destroyed after the internal Wayland connection is destroyed.

This change parents the created Outputs to the Registry like the other
objects. To ensure that the KWin::QPA::Screen doesn't have a problem
with that, it is changed to a QPointer - nullptr checks are already in
place.

Hopefully that will fix the crashes on build.kde.org, but there is a
chance that more errors are hidden.
This commit is contained in:
Martin Gräßlin 2016-10-28 10:12:15 +02:00
parent 19147f5f85
commit acb4336932
3 changed files with 5 additions and 3 deletions

View file

@ -226,7 +226,7 @@ void Integration::createWaylandOutput(quint32 name, quint32 version)
m_dummyScreen = nullptr;
}
using namespace KWayland::Client;
auto o = m_registry->createOutput(name, version, this);
auto o = m_registry->createOutput(name, version, m_registry);
connect(o, &Output::changed, this,
[this, o] {
disconnect(o, &Output::changed, nullptr, nullptr);

View file

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "screen.h"
#include "platformcursor.h"
#include "wayland_server.h"
#include <KWayland/Client/output.h>
@ -29,7 +30,7 @@ namespace QPA
Screen::Screen(KWayland::Client::Output *o)
: QPlatformScreen()
, m_output(o)
, m_output(QPointer<KWayland::Client::Output>(o))
, m_cursor(new PlatformCursor)
{
// TODO: connect to resolution changes

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_QPA_SCREEN_H
#include <qpa/qplatformscreen.h>
#include <QPointer>
namespace KWayland
{
@ -50,7 +51,7 @@ public:
QDpi logicalDpi() const override;
private:
KWayland::Client::Output *m_output;
QPointer<KWayland::Client::Output> m_output;
QScopedPointer<PlatformCursor> m_cursor;
};