idle-inhibit: fix use-after-free

A user reported a crash that only reproduces when preloading a hardened
malloc implementation. From the stack trace, this use-after-free seems
to be the most likely cause. Yay hardened malloc!
This commit is contained in:
Isaac Freund 2023-01-21 14:54:14 +01:00
parent 6c7586e8d7
commit a9bfb7c924
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -28,7 +28,8 @@ fn handleDestroy(listener: *wl.Listener(*wlr.IdleInhibitorV1), _: *wlr.IdleInhib
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self); const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
server.idle_inhibitor_manager.inhibitors.remove(node); server.idle_inhibitor_manager.inhibitors.remove(node);
util.gpa.destroy(node);
self.inhibitor_manager.idleInhibitCheckActive(); self.inhibitor_manager.idleInhibitCheckActive();
util.gpa.destroy(node);
} }