mirror of
https://github.com/hyprwm/aquamarine.git
synced 2025-12-24 21:50:14 +01:00
wayland: Fix backend idleCallbacks destruction (#151)
This commit is contained in:
parent
b236a43699
commit
81498562d0
1 changed files with 6 additions and 3 deletions
|
|
@ -508,7 +508,6 @@ Aquamarine::CWaylandOutput::CWaylandOutput(const std::string& name_, Hyprutils::
|
||||||
}
|
}
|
||||||
|
|
||||||
Aquamarine::CWaylandOutput::~CWaylandOutput() {
|
Aquamarine::CWaylandOutput::~CWaylandOutput() {
|
||||||
backend->idleCallbacks.clear(); // FIXME: mega hack to avoid a UAF in frame events
|
|
||||||
events.destroy.emit();
|
events.destroy.emit();
|
||||||
if (waylandState.xdgToplevel)
|
if (waylandState.xdgToplevel)
|
||||||
waylandState.xdgToplevel->sendDestroy();
|
waylandState.xdgToplevel->sendDestroy();
|
||||||
|
|
@ -769,8 +768,12 @@ void Aquamarine::CWaylandOutput::scheduleFrame(const scheduleFrameReason reason)
|
||||||
|
|
||||||
if (waylandState.frameCallback)
|
if (waylandState.frameCallback)
|
||||||
frameScheduledWhileWaiting = true;
|
frameScheduledWhileWaiting = true;
|
||||||
else
|
else {
|
||||||
backend->idleCallbacks.emplace_back([this]() { sendFrameAndSetCallback(); });
|
backend->idleCallbacks.emplace_back([w = self]() {
|
||||||
|
if (auto o = w.lock())
|
||||||
|
o->sendFrameAndSetCallback();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Aquamarine::CWaylandBuffer::CWaylandBuffer(SP<IBuffer> buffer_, Hyprutils::Memory::CWeakPointer<CWaylandBackend> backend_) : buffer(buffer_), backend(backend_) {
|
Aquamarine::CWaylandBuffer::CWaylandBuffer(SP<IBuffer> buffer_, Hyprutils::Memory::CWeakPointer<CWaylandBackend> backend_) : buffer(buffer_), backend(backend_) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue