Fix crash when processing renames in wxMSW wxFileSystemWatcher

It could (and did, albeit rarely) happen that we read only the first of
the couple events associated with a file rename and in this case the
code crashed due to dereferencing invalid iterator.

Ideal would be to delay sending the "renamed" event until we get the new
path, but for now just fix the crash by not using the invalid iterator.

Closes #24119.
This commit is contained in:
Rick 2023-12-06 11:52:45 +01:00 committed by Vadim Zeitlin
parent 96b5c1419b
commit e758d8ad80

View file

@ -349,6 +349,8 @@ void wxIOCPThread::ProcessNativeEvents(wxVector<wxEventProcessingData>& events)
}
wxFileSystemWatcherEvent event(flags, oldpath, newpath);
SendEvent(event);
if ( it == events.end() )
break;
}
// all other events
else