]> git.saurik.com Git - wxWidgets.git/commitdiff
Log invalid inotify() events without a valid watch descriptor.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 29 Nov 2012 22:02:58 +0000 (22:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 29 Nov 2012 22:02:58 +0000 (22:02 +0000)
Apparently we can get events without any valid watch descriptor, even though
this is not supposed to happen. At least warn about them.

See #14854.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/fswatcher_inotify.cpp

index 3d6e8eb0f76d15fbcc8b9ded86520d39f3fe25bc..1f1517b3f71cc30c69f500597512574fa1510a7e 100644 (file)
@@ -271,6 +271,24 @@ protected:
             return;
         }
 
+        if (inevt.wd == -1)
+        {
+            // Although this is not supposed to happen, we seem to be getting
+            // occasional IN_ACCESS/IN_MODIFY events without valid watch value.
+            wxFileSystemWatcherEvent
+                event
+                (
+                    wxFSW_EVENT_WARNING,
+                    wxString::Format
+                    (
+                        _("Invalid inotify event for \"%s\""),
+                        inevt.len ? inevt.name : ""
+                    )
+                );
+            SendEvent(event);
+            return;
+        }
+
         wxFSWatchEntry& watch = *(it->second);
 
         // Now IN_UNMOUNT. We must do so here, as it's not in the watch flags