[evolution-data-server] Correct new module detection when installed by file rename



commit 664cfac365b2ec108cdedb942448693300ac9582
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 20 18:39:02 2016 +0100

    Correct new module detection when installed by file rename
    
    When a package manager installs a module file by copying it with a different
    name first, then renaming it to the correct name, then this was not properly
    recognized and the module addition had been ignored, which resulted in
    the opposite than this module-auto-load had been created.

 src/libebackend/e-dbus-server.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/libebackend/e-dbus-server.c b/src/libebackend/e-dbus-server.c
index cc67b14..2fa2697 100644
--- a/src/libebackend/e-dbus-server.c
+++ b/src/libebackend/e-dbus-server.c
@@ -542,11 +542,22 @@ dbus_server_module_directory_changed_cb (GFileMonitor *monitor,
        if (event_type == G_FILE_MONITOR_EVENT_CREATED ||
            event_type == G_FILE_MONITOR_EVENT_DELETED ||
            event_type == G_FILE_MONITOR_EVENT_MOVED_IN ||
-           event_type == G_FILE_MONITOR_EVENT_MOVED_OUT) {
+           event_type == G_FILE_MONITOR_EVENT_MOVED_OUT ||
+           event_type == G_FILE_MONITOR_EVENT_RENAMED) {
                gchar *filename;
 
                filename = g_file_get_path (file);
 
+               if (event_type == G_FILE_MONITOR_EVENT_RENAMED && other_file) {
+                       G_LOCK (loaded_modules);
+                       if (!g_hash_table_contains (loaded_modules, filename)) {
+                               g_free (filename);
+                               filename = g_file_get_path (other_file);
+                               event_type = G_FILE_MONITOR_EVENT_CREATED;
+                       }
+                       G_UNLOCK (loaded_modules);
+               }
+
                if (filename && g_str_has_suffix (filename, "." G_MODULE_SUFFIX)) {
                        gboolean any_loaded = FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]