Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/wayland/session_lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,22 @@ void WlSessionLock::realizeLockTarget(WlSessionLock* old) {
void WlSessionLock::unlock() {
this->lockTarget = false;

for (auto* surface: this->surfaces) {
surface->deleteLater();
}

auto surfaces = this->surfaces.values();
this->surfaces.clear();

// finish frames before unlocking, or they can hang forever
for (auto* surface: surfaces) {
surface->finishFrames();
}

auto wasLocked = this->isLocked();
if (this->manager) this->manager->unlock();

for (auto* surface: surfaces) {
surface->destroyWindow();
surface->deleteLater();
}

if (wasLocked) emit this->lockStateChanged();
}

Expand Down Expand Up @@ -300,6 +308,15 @@ void WlSessionLockSurface::show() {
this->ext->setVisible();
}

// waits for the current frame
void WlSessionLockSurface::finishFrames() {
if (this->window != nullptr) this->window->releaseResources();
}

void WlSessionLockSurface::destroyWindow() {
if (this->window != nullptr) this->window->destroy();
}

QQuickItem* WlSessionLockSurface::contentItem() const { return this->mContentItem; }

bool WlSessionLockSurface::isVisible() const {
Expand Down
2 changes: 2 additions & 0 deletions src/wayland/session_lock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class WlSessionLockSurface: public Reloadable {

void attach();
void show();
void finishFrames();
void destroyWindow();

[[nodiscard]] QQuickItem* contentItem() const;

Expand Down
Loading