Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix handling "active" state for KisWaylandSurfaceColorManager

Dmitry Kazakov4a5c0e584d9b
diff --git a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
index 1c9845ed20..f0e822ebbe 100644
--- a/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
+++ b/plugins/platforms/wayland/waylandcolormanagement/KisWaylandSurfaceColorManager.cpp
@@ -266,6 +266,11 @@ QFuture<bool> KisWaylandSurfaceColorManager::setSurfaceDescription(const KisSurf
future.then([this, desc, descriptionObject, waylandIntent, intent] (QFuture<bool> future) {
if (!future.result()) return false;
+ if (!m_surface) {
+ qWarning() << "WARNING: the surface has been desctroyed while its format was being set!";
+ return false;
+ }
+
#ifdef USE_KWIN_BUG_WORKAROUND
// WARNING: KWin <= 6.4.4 doesn't handle intent changes properly
if (m_currentDescription && m_currentDescription == desc &&
@@ -334,6 +339,7 @@ void KisWaylandSurfaceColorManager::slotPlatformWindowCreated()
qWarning() << " " << ppVar(m_currentState);
m_currentState = tryDeinitialize(WaylandSurfaceState::Connected);
KIS_SAFE_ASSERT_RECOVER_RETURN(m_currentState == WaylandSurfaceState::Connected);
+ setReadyImpl(false);
}
auto newState = tryInitilize();
@@ -350,6 +356,7 @@ void KisWaylandSurfaceColorManager::slotPlatformWindowDestroyed()
auto newState = tryDeinitialize(WaylandSurfaceState::Connected);
KIS_SAFE_ASSERT_RECOVER_NOOP(newState <= WaylandSurfaceState::Connected);
m_currentState = newState;
+ setReadyImpl(false);
}
void KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated()
@@ -359,6 +366,7 @@ void KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated()
qWarning() << " " << ppVar(m_currentState);
m_currentState = tryDeinitialize(WaylandSurfaceState::WaylandWindowCreated);
KIS_SAFE_ASSERT_RECOVER_RETURN(m_currentState == WaylandSurfaceState::WaylandWindowCreated);
+ setReadyImpl(false);
}
auto newState = tryInitilize();
@@ -374,6 +382,7 @@ void KisWaylandSurfaceColorManager::slotWaylandSurfaceDestroyed()
auto newState = tryDeinitialize(WaylandSurfaceState::WaylandWindowCreated);
KIS_SAFE_ASSERT_RECOVER_NOOP(newState <= WaylandSurfaceState::WaylandWindowCreated);
m_currentState = newState;
+ setReadyImpl(false);
}
KisWaylandSurfaceColorManager::WaylandSurfaceState