[Xfce4-commits] [xfce/thunar] 01/01: Crash in tree-view when multiple windows are open (Bug #14714)

noreply at xfce.org noreply at xfce.org
Sat Oct 6 22:00:00 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit 59bad0ce5de26d117dc9350d78fbb67bb4735faf
Author: Alexander Schwinn <alexxcons at xfce.org>
Date:   Tue Oct 2 22:05:52 2018 +0200

    Crash in tree-view when multiple windows are open (Bug #14714)
---
 thunar/thunar-tree-model.c | 38 --------------------------------------
 thunar/thunar-tree-model.h |  2 --
 thunar/thunar-tree-view.c  | 11 ++++++++---
 3 files changed, 8 insertions(+), 43 deletions(-)

diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c
index 52f4fe8..0596f05 100644
--- a/thunar/thunar-tree-model.c
+++ b/thunar/thunar-tree-model.c
@@ -1779,44 +1779,6 @@ thunar_tree_model_node_traverse_visible (GNode    *node,
 
 
 /**
- * thunar_tree_model_get_default:
- *
- * Returns the default, shared #ThunarTreeModel instance.
- *
- * The caller is responsible to free the returned instance
- * using g_object_unref() when no longer needed.
- *
- * Return value: a reference to the default #ThunarTreeModel.
- **/
-ThunarTreeModel*
-thunar_tree_model_get_default (void)
-{
-  static ThunarTreeModel *model = NULL;
-  ThunarPreferences      *preferences;
-
-  if (G_LIKELY (model == NULL))
-    {
-      /* allocate the shared model on-demand */
-      model = g_object_new (THUNAR_TYPE_TREE_MODEL, NULL);
-      g_object_add_weak_pointer (G_OBJECT (model), (gpointer) &model);
-
-      /* synchronize the the global "misc-case-sensitive" preference */
-      preferences = thunar_preferences_get ();
-      g_object_set_data_full (G_OBJECT (model), I_("thunar-preferences"), preferences, g_object_unref);
-      exo_binding_new (G_OBJECT (preferences), "misc-case-sensitive", G_OBJECT (model), "case-sensitive");
-    }
-  else
-    {
-      /* take a reference for the caller */
-      g_object_ref (G_OBJECT (model));
-    }
-
-  return model;
-}
-
-
-
-/**
  * thunar_tree_model_get_case_sensitive:
  * @model : a #ThunarTreeModel.
  *
diff --git a/thunar/thunar-tree-model.h b/thunar/thunar-tree-model.h
index 5c7f5f3..0bc0cf2 100644
--- a/thunar/thunar-tree-model.h
+++ b/thunar/thunar-tree-model.h
@@ -59,8 +59,6 @@ typedef enum
 
 GType            thunar_tree_model_get_type           (void) G_GNUC_CONST;
 
-ThunarTreeModel *thunar_tree_model_get_default        (void);
-
 void             thunar_tree_model_set_visible_func   (ThunarTreeModel            *model,
                                                        ThunarTreeModelVisibleFunc  func,
                                                        gpointer                    data);
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 0d2d2ce..77048d7 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -392,8 +392,13 @@ thunar_tree_view_init (ThunarTreeView *view)
   view->preferences = thunar_preferences_get ();
   g_signal_connect_swapped (G_OBJECT (view->preferences), "notify::tree-icon-emblems", G_CALLBACK (gtk_widget_queue_draw), view);
 
-  /* connect to the default tree model */
-  view->model = thunar_tree_model_get_default ();
+  /* Create a tree model for this tree view */
+  view->model = g_object_new (THUNAR_TYPE_TREE_MODEL, NULL);
+
+  /* synchronize the the global "misc-case-sensitive" preference */
+  g_object_set_data_full (G_OBJECT (view->model), I_("thunar-preferences"), view->preferences, g_object_unref);
+  exo_binding_new (G_OBJECT (view->preferences), "misc-case-sensitive", G_OBJECT (view->model), "case-sensitive");
+
   thunar_tree_model_set_visible_func (view->model, thunar_tree_view_visible_func, view);
   gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (view->model));
 
@@ -487,7 +492,7 @@ thunar_tree_view_finalize (GObject *object)
   /* release our reference on the preferences */
   g_object_unref (G_OBJECT (view->preferences));
 
-  /* disconnect from the default tree model */
+  /* free the tree model */
   g_object_unref (G_OBJECT (view->model));
 
   /* drop any existing "new-files" closure */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list