]> www.fi.muni.cz Git - evince.git/commitdiff
Fix some memory leaks.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 9 May 2006 18:00:47 +0000 (18:00 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Tue, 9 May 2006 18:00:47 +0000 (18:00 +0000)
2006-05-09  Carlos Garcia Campos  <carlosgc@gnome.org>
* pdf/ev-poppler.cc:
* shell/ev-application.[ch]:
* shell/main.c:
Fix some memory leaks.

ChangeLog
pdf/ev-poppler.cc
shell/ev-application.c
shell/ev-application.h
shell/main.c

index eb53f525e63f2231d0a1db96146607645580d942..d56e8fb2b891e87166205f6adba631360cd0351b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-09  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * pdf/ev-poppler.cc:
+       * shell/ev-application.[ch]:
+       * shell/main.c:
+
+       Fix some memory leaks.
+
 2006-05-09  Wouter Bolsterlee  <uws+gnome@xs4all.nl>
 
        * shell/ev-properties-dialog.c: (ev_properties_dialog_init):
index 5c2f54d6ed6e7937cdd7fd81e5f29c148641b5a8..a3d38726c81c227a56bf9fe8b77c0b194f0d2e06 100644 (file)
@@ -964,6 +964,7 @@ build_tree (PdfDocument      *pdf_document,
                if (child)
                        build_tree (pdf_document, model, &tree_iter, child);
                poppler_index_iter_free (child);
+               poppler_action_free (action);
                
        } while (poppler_index_iter_next (iter));
 }
index de5e3a0c813820f21753fa39136d4d84dc9aca93..ffa58ee72ee00274cc7f05cead9f7855cd89e5ec 100644 (file)
 
 G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
 
-#define EV_APPLICATION_GET_PRIVATE(object) \
-       (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_APPLICATION, EvApplicationPrivate))
-
 #define APPLICATION_SERVICE_NAME "org.gnome.evince.ApplicationService"
 
 #ifdef ENABLE_DBUS
 gboolean
 ev_application_register_service (EvApplication *application)
 {
-       DBusGConnection *connection;
+       static DBusGConnection *connection = NULL;
        DBusGProxy *driver_proxy;
        GError *err = NULL;
        guint request_name_result;
 
+       if (connection) {
+               g_warning ("Service already registered.");
+               return FALSE;
+       }
+       
        connection = dbus_g_bus_get (DBUS_BUS_STARTER, &err);
        if (connection == NULL) {
                g_warning ("Service registration failed.");
@@ -90,6 +92,8 @@ ev_application_register_service (EvApplication *application)
        }
 #endif 
 
+       g_object_unref (driver_proxy);
+       
        if (request_name_result == DBUS_REQUEST_NAME_REPLY_EXISTS) {
                return FALSE;
        }
@@ -325,7 +329,7 @@ ev_application_shutdown (EvApplication *application)
                g_object_unref (application->recent_model);
                application->recent_model = NULL;
        }
-
+       
        g_free (application->last_chooser_uri);
        g_object_unref (application);
        
index 2202a9a32fef8bddc8255a1a1557aa8822231ca3..0c562c0b62bd75eadc642f0158cae1f331d81fa1 100644 (file)
@@ -35,7 +35,6 @@ G_BEGIN_DECLS
 
 typedef struct _EvApplication EvApplication;
 typedef struct _EvApplicationClass EvApplicationClass;
-typedef struct _EvApplicationPrivate EvApplicationPrivate;
 
 #define EV_TYPE_APPLICATION                    (ev_application_get_type ())
 #define EV_APPLICATION(object)                 (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_APPLICATION, EvApplication))
index 3a38986bb813625dd515df683ffedabb6d4dbb9c..91a62d258b5299519f59bf293c45bf281151233c 100644 (file)
@@ -158,6 +158,8 @@ load_files_remote (const char **files)
                if (!dbus_g_proxy_end_call (remote_object, call, &error, DBUS_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
+                       g_object_unref (remote_object);
+                       dbus_g_connection_unref (connection);
                        return FALSE;
                }
 #elif DBUS_VERSION == 34
@@ -168,6 +170,8 @@ load_files_remote (const char **files)
                if (!dbus_g_proxy_end_call (remote_object, call, &error, G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
+                       g_object_unref (remote_object);
+                       dbus_g_connection_unref (connection);
                        return FALSE;
                }
 #else
@@ -177,9 +181,14 @@ load_files_remote (const char **files)
                                        G_TYPE_INVALID)) {
                        g_warning (error->message);
                        g_clear_error (&error);
+                       g_object_unref (remote_object);
+                       dbus_g_connection_unref (connection);
                        return FALSE;
                }
 #endif
+               g_object_unref (remote_object);
+               dbus_g_connection_unref (connection);
+               
                return TRUE;
        }
 
@@ -232,6 +241,9 @@ load_files_remote (const char **files)
                result = TRUE;
         }
 
+       g_object_unref (remote_object);
+       dbus_g_connection_unref (connection);
+
        gdk_notify_startup_complete ();
 
        return result;