[gnome-commander/get_rid_of_xml] Unref connections list, free pixmap memory in destroy methods



commit 501386623622517100db7b1cac2229b2d8ebb15b
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Dec 3 12:40:48 2018 +0100

    Unref connections list, free pixmap memory in destroy methods

 src/gnome-cmd-con-home.cc   | 6 ++++++
 src/gnome-cmd-con-remote.cc | 6 ++++++
 src/gnome-cmd-con-smb.cc    | 6 ++++++
 src/gnome-cmd-con.cc        | 1 +
 src/gnome-cmd-data.cc       | 3 ++-
 5 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/src/gnome-cmd-con-home.cc b/src/gnome-cmd-con-home.cc
index fd42fed6..479d45a2 100644
--- a/src/gnome-cmd-con-home.cc
+++ b/src/gnome-cmd-con-home.cc
@@ -79,6 +79,12 @@ static GnomeCmdPath *home_create_path (GnomeCmdCon *con, const gchar *path_str)
 
 static void destroy (GtkObject *object)
 {
+    GnomeCmdConHome *con_home = GNOME_CMD_CON_HOME (object);
+
+    gnome_cmd_pixmap_free (con_home->parent.go_pixmap);
+    gnome_cmd_pixmap_free (con_home->parent.open_pixmap);
+    gnome_cmd_pixmap_free (con_home->parent.close_pixmap);
+
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
         (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
diff --git a/src/gnome-cmd-con-remote.cc b/src/gnome-cmd-con-remote.cc
index 7b5232d0..0d56dafe 100644
--- a/src/gnome-cmd-con-remote.cc
+++ b/src/gnome-cmd-con-remote.cc
@@ -145,6 +145,12 @@ static GnomeCmdPath *remote_create_path (GnomeCmdCon *con, const gchar *path_str
 
 static void destroy (GtkObject *object)
 {
+    GnomeCmdConRemote *con_remote = GNOME_CMD_CON_REMOTE (object);
+
+    gnome_cmd_pixmap_free (con_remote->parent.go_pixmap);
+    gnome_cmd_pixmap_free (con_remote->parent.open_pixmap);
+    gnome_cmd_pixmap_free (con_remote->parent.close_pixmap);
+
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
         (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
diff --git a/src/gnome-cmd-con-smb.cc b/src/gnome-cmd-con-smb.cc
index 7815cab6..e5f02cb7 100644
--- a/src/gnome-cmd-con-smb.cc
+++ b/src/gnome-cmd-con-smb.cc
@@ -170,6 +170,12 @@ static GnomeCmdPath *smb_create_path (GnomeCmdCon *con, const gchar *path_str)
 
 static void destroy (GtkObject *object)
 {
+    GnomeCmdConSmb *con_smb = GNOME_CMD_CON_SMB (object);
+
+    gnome_cmd_pixmap_free (con_smb->parent.go_pixmap);
+    gnome_cmd_pixmap_free (con_smb->parent.open_pixmap);
+    gnome_cmd_pixmap_free (con_smb->parent.close_pixmap);
+
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
         (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
 }
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 7909aba7..7872b491 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -95,6 +95,7 @@ static void destroy (GtkObject *object)
     g_free (con->close_text);
     g_free (con->close_tooltip);
     gnome_cmd_pixmap_free (con->close_pixmap);
+    gnome_cmd_pixmap_free (con->go_pixmap);
 
     if (con->priv->default_dir)
         gnome_cmd_dir_unref (con->priv->default_dir);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index e1f47e79..840225e3 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -2730,7 +2730,8 @@ GnomeCmdData::~GnomeCmdData()
     if (priv)
     {
         // free the connections
-        // g_object_unref (priv->con_list);
+        g_object_ref_sink (priv->con_list);
+        g_object_unref (priv->con_list);
 
         // close quick connect
         if (quick_connect)


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