Skip to content

Commit 1a9964a

Browse files
committed
selectionEdgeDestroy: wait for both destroy and unmap event
1 parent 2d00d5e commit 1a9964a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/selection_edge.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ void selectionEdgeDestroy(void)
131131
if (pe->wndDraw != None) {
132132
XSelectInput(disp, pe->wndDraw, StructureNotifyMask);
133133
XDestroyWindow(disp, pe->wndDraw);
134-
for (XEvent ev; true;) {
134+
bool is_unmapped = false, is_destroyed = false;
135+
for (XEvent ev; !(is_unmapped && is_destroyed);) {
135136
XNextEvent(disp, &ev);
136137
if (ev.type == DestroyNotify && ev.xdestroywindow.window == pe->wndDraw)
137-
break;
138+
is_destroyed = true;
139+
if (ev.type == UnmapNotify && ev.xunmap.window == pe->wndDraw)
140+
is_unmapped = true;
138141
}
139142
/* HACK: although we recived a DestroyNotify event, the frame still
140143
* might not have been updated. a compositor might also buffer frames

0 commit comments

Comments
 (0)