Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2006-05-09 18:00:47 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2006-05-09 18:00:47 (GMT)
commit88ae241f9ed612041aa97fb0027d95169f89a026 (patch)
treea9188ca9231e270e9a37e8d84cd86ba695fc5909
parent9341f430889ed826f8b326be923af9807d4133ee (diff)
Fix some memory leaks.
2006-05-09 Carlos Garcia Campos <carlosgc@gnome.org> * pdf/ev-poppler.cc: * shell/ev-application.[ch]: * shell/main.c: Fix some memory leaks.
-rw-r--r--ChangeLog8
-rw-r--r--pdf/ev-poppler.cc1
-rw-r--r--shell/ev-application.c14
-rw-r--r--shell/ev-application.h1
-rw-r--r--shell/main.c12
5 files changed, 30 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index eb53f52..d56e8fb 100644
--- 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):
diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc
index 5c2f54d..a3d3872 100644
--- a/pdf/ev-poppler.cc
+++ b/pdf/ev-poppler.cc
@@ -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));
}
diff --git a/shell/ev-application.c b/shell/ev-application.c
index de5e3a0..ffa58ee 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -46,20 +46,22 @@
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);
diff --git a/shell/ev-application.h b/shell/ev-application.h
index 2202a9a..0c562c0 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -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))
diff --git a/shell/main.c b/shell/main.c
index 3a38986..91a62d2 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -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;