In this case, MSI should not be calling MsgWaitForMultipleObjects with an invalid handle and in fact that barring memory corruption, this can't happen:
You're right, my patch was incorrect, I made bad assumption.
I'm still not sure why this X11DRV_MsgWaitForMultipleObjectsEx is testing for "(count || timeout)", rather than "(count && timeout)" or just "count" at:
if (process_events( data->display, mask )) ret = count - 1; else if (count || timeout) { ret = WaitForMultipleObjectsEx( count, handles, flags &
MWMO_WAITALL, timeout, flags & MWMO_ALERTABLE );
I can see that msi_dialog_run_message_loop calls "MsgWaitForMultipleObjects( 0, NULL, 0, INFINITE, QS_ALLINPUT );" which implies that "WaitForMultipleObjects( 0, NULL, 0, INFINITE, MWMO_ALERTABLE );" can be called if precess_events returns FALSE.
I'm pretty sure I saw in gdb some calls with NULL handles to WaitForMultipleObjects related to MSI.
Regards,