xdg-toplevel: remove listeners before view destroy

Currently in handleUnmap() we call View.unmap() before removing
listeners. However View.unmap() may destroy the view before returning
if the transaction started doesn't have to wait on any configures.

To ensure that we don't try to remove listeners which have already been
free'd, do this before calling View.unmap().
This commit is contained in:
Isaac Freund
2021-06-17 20:57:14 +00:00
parent 5daec347c0
commit a2c81adba0
3 changed files with 6 additions and 4 deletions

View File

@ -384,13 +384,12 @@ fn commitTransaction(self: *Self) void {
var view_it = output.views.first;
while (view_it) |view_node| {
const view = &view_node.view;
view_it = view_node.next;
if (view.destroying) {
view_it = view_node.next;
view.destroy();
continue;
}
defer view_it = view_node.next;
if (view.pending_serial != null and !view.shouldTrackConfigure()) continue;