]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fswatcher_inotify.cpp
Use disabled colour for the dropdown arrow of disabled ribbon.
[wxWidgets.git] / src / unix / fswatcher_inotify.cpp
index 3d6e8eb0f76d15fbcc8b9ded86520d39f3fe25bc..f23f4439e3686dbb8c23207c3ebb09e4bbf8e87a 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
@@ -420,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);
+                    }
                 }
             }