From dab61056c8ed77bc386728842bab187db1a7cce2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 29 Nov 2012 22:03:21 +0000 Subject: [PATCH] Don't assert when stopping watching a just renamed file. (Almost) silently ignore renames of the files which we don't watch any longer instead of asserting if this happens. Closes #14863. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/fswatcher_inotify.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/unix/fswatcher_inotify.cpp b/src/unix/fswatcher_inotify.cpp index 1f1517b3f7..f23f4439e3 100644 --- a/src/unix/fswatcher_inotify.cpp +++ b/src/unix/fswatcher_inotify.cpp @@ -438,19 +438,24 @@ protected: // get watch entry for this event wxFSWatchEntryDescriptors::iterator wit = m_watchMap.find(inevt.wd); - wxCHECK_RET(wit != m_watchMap.end(), - "Watch descriptor not present in the watch map!"); - - // Tell the owner, in case it's interested - // If there's a filespec, assume he's not - wxFSWatchEntry& watch = *(wit->second); - if ( watch.GetFilespec().empty() ) + if (wit == m_watchMap.end()) + { + wxLogTrace(wxTRACE_FSWATCHER, + "Watch descriptor not present in the watch map!"); + } + else { - int flags = Native2WatcherFlags(inevt.mask); - wxFileName path = GetEventPath(watch, inevt); + // Tell the owner, in case it's interested + // If there's a filespec, assume he's not + wxFSWatchEntry& watch = *(wit->second); + if ( watch.GetFilespec().empty() ) { - wxFileSystemWatcherEvent event(flags, path, path); - SendEvent(event); + int flags = Native2WatcherFlags(inevt.mask); + wxFileName path = GetEventPath(watch, inevt); + { + wxFileSystemWatcherEvent event(flags, path, path); + SendEvent(event); + } } } -- 2.47.2