[gnome-builder/gnome-builder-3-24] flatpak: Keep file monitor for deleted manifests



commit 68b39aa1be357b0b695a7bc725268123f8089300
Author: Matthew Leeds <mleeds redhat com>
Date:   Thu Mar 23 18:07:29 2017 -0500

    flatpak: Keep file monitor for deleted manifests
    
    Some git operations such as "git revert" cause the following sequence of
    GFileMonitor events: DELETED, CREATED, CHANGED, CHANGES_DONE_HINT. This
    means that we need to keep the monitor for a "deleted" manifest in order
    to get the following events and recreate it. Unfortunately this also
    means we're parsing the manifest and creating a config for it twice for
    one set of changes, but not much can be done about that.

 .../flatpak/gbp-flatpak-configuration-provider.c   |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-configuration-provider.c 
b/plugins/flatpak/gbp-flatpak-configuration-provider.c
index 6733a12..8fb668a 100644
--- a/plugins/flatpak/gbp-flatpak-configuration-provider.c
+++ b/plugins/flatpak/gbp-flatpak-configuration-provider.c
@@ -698,7 +698,9 @@ gbp_flatpak_configuration_provider_manifest_changed (GbpFlatpakConfigurationProv
         }
     }
 
-  if (relevant_config == NULL)
+  if (relevant_config == NULL &&
+      event != G_FILE_MONITOR_EVENT_CREATED &&
+      event != G_FILE_MONITOR_EVENT_MOVED_IN)
     IDE_EXIT;
 
   new_config_file = file;
@@ -708,7 +710,6 @@ gbp_flatpak_configuration_provider_manifest_changed (GbpFlatpakConfigurationProv
     case G_FILE_MONITOR_EVENT_MOVED_OUT:
       ide_configuration_manager_remove (self->manager, IDE_CONFIGURATION (relevant_config));
       g_ptr_array_remove_fast (self->configurations, relevant_config);
-      g_ptr_array_remove_fast (self->manifest_monitors, file_monitor);
       break;
 
     case G_FILE_MONITOR_EVENT_RENAMED:
@@ -756,8 +757,11 @@ gbp_flatpak_configuration_provider_manifest_changed (GbpFlatpakConfigurationProv
                   g_ptr_array_add (self->manifest_monitors, g_steal_pointer (&manifest_monitor));
                 }
 
-              ide_configuration_manager_remove (self->manager, IDE_CONFIGURATION (relevant_config));
-              g_ptr_array_remove_fast (self->configurations, relevant_config);
+              if (relevant_config != NULL)
+                {
+                  ide_configuration_manager_remove (self->manager, IDE_CONFIGURATION (relevant_config));
+                  g_ptr_array_remove_fast (self->configurations, relevant_config);
+                }
               g_ptr_array_remove_fast (self->manifest_monitors, file_monitor);
               ide_configuration_manager_add (self->manager, IDE_CONFIGURATION (new_config));
               ide_configuration_manager_set_current (self->manager, IDE_CONFIGURATION (new_config));


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