Fix use of dangling reference in wxFileSystemWatcher Unix code

Don't reference the "watch" object after possibly destroying it when handling
IN_DELETE_SELF inotify notification.

Closes #17122.
This commit is contained in:
David Hart
2016-08-19 23:19:14 +02:00
committed by Vadim Zeitlin
parent 6537356236
commit 34d39c9dfb
2 changed files with 3 additions and 1 deletions

View File

@@ -107,6 +107,7 @@ wxGTK:
- Improve wxSpinCtrl best size calculation.
- Implement support for icon locations in wxMimeTypesManager (Hanmac).
- Cosmetic fix for empty wxCheckBoxes display (Chuddah).
- Fix crashes in wxFileSystemWatcher implementation (David Hart).
wxMSW:

View File

@@ -385,6 +385,7 @@ protected:
// if the wd isn't found: repeated IN_DELETE_SELFs can occur
wxFileName fn = GetEventPath(watch, inevt);
wxString path(fn.GetPathWithSep());
const wxString filespec(watch.GetFilespec());
if (m_watchMap.erase(inevt.wd) == 1)
{
@@ -406,7 +407,7 @@ protected:
// Tell the owner, in case it's interested
// If there's a filespec, assume he's not
if (watch.GetFilespec().empty())
if (filespec.empty())
{
wxFileSystemWatcherEvent event(flags, fn, fn);
SendEvent(event);