+2008-08-03 Tor Lillqvist <tml@novell.com>
+
+ Bug 541036 - Gnumeric crashes when trying to open Desktop or
+ user's folder under Windows
+
+ * win32/gwin32directorymonitor.c
+ (g_win32_directory_monitor_constructor): Ignore error from
+ CreateFile() when opening directory. Instead of asserting, just
+ store INVALID_HANDLE_VALUE then in
+ GWin32DirectoryMonitorPrivate::hDirectory. Also ignore error from
+ ReadDirectoryChangesW().
+ (g_win32_directory_monitor_cancel): Don't attempt to close
+ directory handle if it is INVALID_HANDLE_VALUE.
+
2008-08-01 Matthias Clasen <mclasen@redhat.com>
* gdesktopappinfo.c: Remove debug spew
self = G_WIN32_DIRECTORY_MONITOR (base);
/* this triggers a last callback() with nBytes=0 */
- CloseHandle (self->priv->hDirectory);
+ if (self->priv->hDirectory != INVALID_HANDLE_VALUE)
+ CloseHandle (self->priv->hDirectory);
if (G_FILE_MONITOR_CLASS (g_win32_directory_monitor_parent_class)->cancel)
(*G_FILE_MONITOR_CLASS (g_win32_directory_monitor_parent_class)->cancel) (base);
self->priv->hDirectory = CreateFile (dirname, FILE_LIST_DIRECTORY, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL);
- g_assert (self->priv->hDirectory != INVALID_HANDLE_VALUE); /* harsh */
+ if (self->priv->hDirectory == INVALID_HANDLE_VALUE)
+ {
+ /* Ignore errors */
+ return obj;
+ }
result = ReadDirectoryChangesW (self->priv->hDirectory, (gpointer)self->priv->file_notify_buffer, self->priv->buffer_allocated_bytes, FALSE,
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES |
FILE_NOTIFY_CHANGE_SIZE, &self->priv->buffer_filled_bytes, &self->priv->overlapped, g_win32_directory_monitor_callback);
- g_assert (result); /* harsh */
-
+ /* Ignore errors */
+
return obj;
}