Index: thunar-vfs/thunar-vfs-job.c =================================================================== --- thunar-vfs/thunar-vfs-job.c (revision 23827) +++ thunar-vfs/thunar-vfs-job.c (working copy) @@ -363,8 +363,12 @@ g_return_if_fail (THUNAR_VFS_IS_JOB (job)); g_return_if_fail (job->priv->running); - /* perform the real work */ - (*THUNAR_VFS_JOB_GET_CLASS (job)->execute) (job); + /* check if we weren't canceled in the meantime */ + if (G_LIKELY (!job->cancelled)) + { + /* perform the real work */ + (*THUNAR_VFS_JOB_GET_CLASS (job)->execute) (job); + } /* mark the job as done */ job->priv->running = FALSE; Index: thunar-vfs/thunar-vfs-monitor.c =================================================================== --- thunar-vfs/thunar-vfs-monitor.c (revision 23827) +++ thunar-vfs/thunar-vfs-monitor.c (working copy) @@ -40,10 +40,10 @@ /* minimum timer interval for feeded events (in ms) */ -#define THUNAR_VFS_MONITOR_TIMER_INTERVAL_FEED (10) +#define THUNAR_VFS_MONITOR_TIMER_INTERVAL_FEED (150) /* minimum timer interval for FAM events (in ms) */ -#define THUNAR_VFS_MONITOR_TIMER_INTERVAL_FAM (200) +#define THUNAR_VFS_MONITOR_TIMER_INTERVAL_FAM (300) /* tagging for notifications, so we can make sure that * (slow) FAM events don't override properly feeded events. @@ -324,69 +324,73 @@ ThunarVfsPath *path; GList *lp; - /* take an additional reference on the monitor, * so we don't accidently - * release the monitor while processing the notifications. - */ - g_object_ref (G_OBJECT (monitor)); + /* try to aquire the lock on the monitor */ + if (g_mutex_trylock (monitor->lock)) + { + /* take an additional reference on the monitor, * so we don't accidently + * release the monitor while processing the notifications. + */ + g_object_ref (G_OBJECT (monitor)); - /* aquire the lock on the monitor */ - g_mutex_lock (monitor->lock); + /* reset the timer id */ + monitor->notifications_timer_id = 0; - /* reset the timer id */ - monitor->notifications_timer_id = 0; + /* process all pending notifications */ + while (monitor->notifications != NULL) + { + /* grab the first notification from the queue */ + notification = monitor->notifications; + monitor->notifications = notification->next; - /* process all pending notifications */ - while (monitor->notifications != NULL) - { - /* grab the first notification from the queue */ - notification = monitor->notifications; - monitor->notifications = notification->next; + /* lookup the handle for the current notification */ + for (lp = monitor->handles; lp != NULL; lp = lp->next) + if (((ThunarVfsMonitorHandle *) lp->data)->fr.reqnum == notification->reqnum) + break; - /* lookup the handle for the current notification */ - for (lp = monitor->handles; lp != NULL; lp = lp->next) - if (((ThunarVfsMonitorHandle *) lp->data)->fr.reqnum == notification->reqnum) - break; + /* check if there's a valid handle */ + if (G_LIKELY (lp != NULL)) + { + /* grab the handle pointer */ + handle = lp->data; - /* check if there's a valid handle */ - if (G_LIKELY (lp != NULL)) - { - /* grab the handle pointer */ - handle = lp->data; + /* determine the event path for the notification */ + if (G_UNLIKELY (notification->filename == NULL)) + path = thunar_vfs_path_ref (handle->path); + else if (G_UNLIKELY (*notification->filename != '/')) + path = thunar_vfs_path_relative (handle->path, notification->filename); + else + path = thunar_vfs_path_new (notification->filename, NULL); - /* determine the event path for the notification */ - if (G_UNLIKELY (notification->filename == NULL)) - path = thunar_vfs_path_ref (handle->path); - else if (G_UNLIKELY (*notification->filename != '/')) - path = thunar_vfs_path_relative (handle->path, notification->filename); - else - path = thunar_vfs_path_new (notification->filename, NULL); + /* invoke the callback (w/o the monitor lock) */ + GDK_THREADS_ENTER (); + g_mutex_unlock (monitor->lock); + (*handle->callback) (monitor, handle, notification->event, handle->path, path, handle->user_data); + g_mutex_lock (monitor->lock); + GDK_THREADS_LEAVE (); - /* invoke the callback (w/o the monitor lock) */ - GDK_THREADS_ENTER (); - g_mutex_unlock (monitor->lock); - (*handle->callback) (monitor, handle, notification->event, handle->path, path, handle->user_data); - g_mutex_lock (monitor->lock); - GDK_THREADS_LEAVE (); + /* cleanup */ + thunar_vfs_path_unref (path); + } - /* cleanup */ - thunar_vfs_path_unref (path); + /* release the current notification */ + g_free (notification); } - /* release the current notification */ - g_free (notification); - } + /* notify all waiting parties */ + g_cond_broadcast (monitor->cond); - /* notify all waiting parties */ - g_cond_broadcast (monitor->cond); + /* release the lock on the monitor */ + g_mutex_unlock (monitor->lock); - /* release the lock on the monitor */ - g_mutex_unlock (monitor->lock); + /* drop the additional reference on the monitor */ + g_object_unref (G_OBJECT (monitor)); - /* drop the additional reference on the monitor */ - g_object_unref (G_OBJECT (monitor)); + /* drop the timer source */ + return FALSE; + } - /* drop the timer source */ - return FALSE; + /* the mutex was locked, another try */ + return TRUE; }