[gnome-control-center/benzea/fix-panel-deactivation: 4/4] shell: Deactivate old panel before creating new one




commit a588c7944757dfc8da93633e807bf06f66823518
Author: Benjamin Berg <bberg redhat com>
Date:   Thu May 12 12:14:28 2022 +0200

    shell: Deactivate old panel before creating new one
    
    We need to cancel internal operations before starting to create a new
    panel, otherwise panels might be creating the same object for the cache
    in parallel and this is not supported by the object cache.
    
    The alternative to this would be to handle this inside the object
    store to allow parallel creation of the same key.
    
    Fixes: #1685

 shell/cc-panel.c  | 8 ++++++++
 shell/cc-panel.h  | 2 ++
 shell/cc-window.c | 2 ++
 3 files changed, 12 insertions(+)
---
diff --git a/shell/cc-panel.c b/shell/cc-panel.c
index d51a8b1cd..cd3e0a813 100644
--- a/shell/cc-panel.c
+++ b/shell/cc-panel.c
@@ -423,3 +423,11 @@ cc_panel_set_titlebar (CcPanel   *panel,
   priv = cc_panel_get_instance_private (panel);
   adw_bin_set_child (priv->titlebar_bin, titlebar);
 }
+
+void
+cc_panel_deactivate (CcPanel *panel)
+{
+  CcPanelPrivate *priv = cc_panel_get_instance_private (panel);
+
+  g_cancellable_cancel (priv->cancellable);
+}
diff --git a/shell/cc-panel.h b/shell/cc-panel.h
index e9c49fad7..8cf09acee 100644
--- a/shell/cc-panel.h
+++ b/shell/cc-panel.h
@@ -104,4 +104,6 @@ GtkWidget*    cc_panel_get_titlebar       (CcPanel     *panel);
 void          cc_panel_set_titlebar       (CcPanel     *panel,
                                            GtkWidget   *titlebar);
 
+void          cc_panel_deactivate         (CcPanel     *panel);
+
 G_END_DECLS
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 3a79b6d97..15d71247f 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -405,6 +405,8 @@ set_active_panel_from_id (CcWindow     *self,
    * just above.
    */
   self->old_panel = self->current_panel;
+  if (self->old_panel)
+    cc_panel_deactivate (CC_PANEL (self->old_panel));
 
   gtk_tree_model_get (GTK_TREE_MODEL (self->store),
                       &iter,


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