Make failure to remove an inotify watch a warning

Apparently this can happen when a directory is deleted just before the watch
is removed and it is impossible to avoid it, so just send a warning message so
that the program could react to this, if necessary, but don't annoy the user
with an error in this case.

See #17122.
This commit is contained in:
David Hart 2016-08-19 23:15:53 +02:00 committed by Vadim Zeitlin
parent 534899baa2
commit 6537356236

View File

@ -129,8 +129,20 @@ public:
int ret = DoRemoveInotify(watch.get());
if (ret == -1)
{
wxLogSysError( _("Unable to remove inotify watch") );
return false;
// Failures can happen if a dir is deleted just before we try to
// remove the watch. I think there's a race between calling this
// code and IN_DELETE_SELF arriving. So just warn.
wxFileSystemWatcherEvent
event
(
wxFSW_EVENT_WARNING, wxFSW_WARNING_GENERAL,
wxString::Format
(
_("Unable to remove inotify watch %i"),
watch->GetWatchDescriptor()
)
);
SendEvent(event);
}
if (m_watchMap.erase(watch->GetWatchDescriptor()) != 1)