Fix crash when the wl_shm global comes after a wl_output one

Task-number: QTBUG-44503
Change-Id: I6932df57bb4560b6dceb72a5cb7c536cd090e92a
Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Giulio Camuffo 2015-04-23 19:32:28 +03:00
parent 022f452ed9
commit f0a58486ef
3 changed files with 8 additions and 1 deletions

View File

@ -239,6 +239,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mScreens.append(screen);
// We need to get the output events before creating surfaces
forceRoundTrip();
screen->init();
mWaylandIntegration->screenAdded(screen);
} else if (interface == QStringLiteral("wl_compositor")) {
mCompositorVersion = qMin((int)version, 3);

View File

@ -60,7 +60,7 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uin
, mFormat(QImage::Format_ARGB32_Premultiplied)
, mOutputName(QStringLiteral("Screen%1").arg(id))
, m_orientation(Qt::PrimaryOrientation)
, mWaylandCursor(new QWaylandCursor(this))
, mWaylandCursor(0)
{
// handle case of output extension global being sent after outputs
createExtendedOutput();
@ -71,6 +71,11 @@ QWaylandScreen::~QWaylandScreen()
delete mWaylandCursor;
}
void QWaylandScreen::init()
{
mWaylandCursor = new QWaylandCursor(this);
}
QWaylandDisplay * QWaylandScreen::display() const
{
return mWaylandDisplay;

View File

@ -53,6 +53,7 @@ public:
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id);
~QWaylandScreen();
void init();
QWaylandDisplay *display() const;
QRect geometry() const;