diff --git a/src/plugins/platforms/wayland/wayland_backend.cpp b/src/plugins/platforms/wayland/wayland_backend.cpp index 38c2a4ad0c..1a451058af 100644 --- a/src/plugins/platforms/wayland/wayland_backend.cpp +++ b/src/plugins/platforms/wayland/wayland_backend.cpp @@ -474,7 +474,7 @@ WaylandBackend::~WaylandBackend() delete m_waylandCursor; m_eventQueue->release(); - qDeleteAll(m_outputs); + destroyOutputs(); if (m_xdgShell) { m_xdgShell->release(); @@ -625,8 +625,7 @@ void WaylandBackend::initConnection() delete m_seat; m_shm->destroy(); - qDeleteAll(m_outputs); - m_outputs.clear(); + destroyOutputs(); if (m_xdgShell) { m_xdgShell->destroy(); @@ -730,11 +729,23 @@ void WaylandBackend::createOutputs() logicalWidthSum += logicalWidth; m_outputs << waylandOutput; + emit outputAdded(waylandOutput); + emit outputEnabled(waylandOutput); } setReady(true); emit screensQueried(); } +void WaylandBackend::destroyOutputs() +{ + while (!m_outputs.isEmpty()) { + WaylandOutput *output = m_outputs.takeLast(); + emit outputDisabled(output); + emit outputRemoved(output); + delete output; + } +} + OpenGLBackend *WaylandBackend::createOpenGLBackend() { #if HAVE_WAYLAND_EGL diff --git a/src/plugins/platforms/wayland/wayland_backend.h b/src/plugins/platforms/wayland/wayland_backend.h index 74ba17f82b..2b8b7d71cf 100644 --- a/src/plugins/platforms/wayland/wayland_backend.h +++ b/src/plugins/platforms/wayland/wayland_backend.h @@ -209,6 +209,7 @@ Q_SIGNALS: private: void initConnection(); void createOutputs(); + void destroyOutputs(); void updateScreenSize(WaylandOutput *output); void relativeMotionHandler(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 timestamp);