Skip to content

Commit

Permalink
Reduced likely hood of race conditions when unmanaged windows still h…
Browse files Browse the repository at this point in the history
…ave properties to be updated (#458)
  • Loading branch information
DerjenigeUberMensch authored Oct 13, 2024
1 parent 417759f commit dd568d1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,25 @@ PropUpdateProperty(
const enum PropertyType type = cookie->type;
const XCBWindow win = cookie->win;
const u8 validtype = PropValidType(type);
u8 valid_client;

if(validtype)
{
cookie->cookie.sequence = 0;
if(__prophandler__[type].get_cookie)
{ cookie->cookie = __prophandler__[type].get_cookie(display, win);
}
if(__prophandler__[type].get_reply)
{ __prophandler__[type].get_reply(display, cookie);
LockMainThread();
valid_client = cookie->cookie.sequence == 0 || wintoclient(win);
UnlockMainThread();
if(valid_client)
{
if(__prophandler__[type].get_reply)
{ __prophandler__[type].get_reply(display, cookie);
}
}
else
{ XCBDiscardReply(display, cookie->cookie);
}
}
}
Expand Down

0 comments on commit dd568d1

Please sign in to comment.