Skip to content
  • Руслан Ижбулатов's avatar
    poll: Prevent false-negative from WAKE_EVENT() on W32 · b87c55f6
    Руслан Ижбулатов authored and Sebastian Dröge's avatar Sebastian Dröge committed
    SetEvent() seems to not call SetLastError(0) internally, so checking last
    error after calling SetEvent() may return the error from an earlier W32 API
    call. Fix this by calling SetlastError(0) explicitly.
    
    Currently WAKE_EVENT() code is cramped into a macro and doesn't look to be
    entirely correct. Particularly, it does not check the return value of
    SetEvent(), only the thread-local W32 error value. It is likely that SetEvent()
    actually just returns non-zero value, but the code mistakenly thinks that the
    call has failed, because GetLastError() seems to indicate so.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733805
    b87c55f6