summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@svn.gnome.org>2007-12-01 19:31:52 +0000
committerPhilip Withnall <pwithnall@src.gnome.org>2007-12-01 19:31:52 +0000
commit2076916d1638446080c6e3609cee3ea199a6789a (patch)
treeb846af76d6b61bd409a92063918796b3e58e9faf
parent4ad3331c16d6b67f3cb3b66ae271df5ff793f13d (diff)
downloadtotem-2076916d1638446080c6e3609cee3ea199a6789a.tar.gz
Plug some memory leaks.
2007-12-01 Philip Withnall <pwithnall@svn.gnome.org> * plparse/totem-disc.c: (cd_cache_new): * plparse/totem-pl-parser.c: (totem_pl_parser_finalize), (totem_pl_parser_parse_internal): * src/ev-sidebar.c: * src/ev-sidebar.h: * src/plugins/tracker/totem-tracker-widget.c: (totem_tracker_widget_class_init), (populate_result), (totem_tracker_widget_init): * src/totem-playlist.c: (totem_playlist_init), (totem_playlist_class_init): * src/totem-sidebar.c: * src/totem-sidebar.h: * src/totem.c: (totem_action_exit): Plug some memory leaks. svn path=/trunk/; revision=4932
-rw-r--r--ChangeLog16
-rw-r--r--plparse/totem-disc.c4
-rw-r--r--plparse/totem-pl-parser.c4
-rw-r--r--src/ev-sidebar.c3
-rw-r--r--src/ev-sidebar.h2
-rw-r--r--src/plugins/tracker/totem-tracker-widget.c14
-rw-r--r--src/totem-playlist.c4
-rw-r--r--src/totem-sidebar.c2
-rw-r--r--src/totem-sidebar.h2
-rw-r--r--src/totem.c1
10 files changed, 42 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 003c7dcd9..8a8d44f23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-12-01 Philip Withnall <pwithnall@svn.gnome.org>
+
+ * plparse/totem-disc.c: (cd_cache_new):
+ * plparse/totem-pl-parser.c: (totem_pl_parser_finalize),
+ (totem_pl_parser_parse_internal):
+ * src/ev-sidebar.c:
+ * src/ev-sidebar.h:
+ * src/plugins/tracker/totem-tracker-widget.c:
+ (totem_tracker_widget_class_init), (populate_result),
+ (totem_tracker_widget_init):
+ * src/totem-playlist.c: (totem_playlist_init),
+ (totem_playlist_class_init):
+ * src/totem-sidebar.c:
+ * src/totem-sidebar.h:
+ * src/totem.c: (totem_action_exit): Plug some memory leaks.
+
2007-12-01 Bastien Nocera <hadess@hadess.net>
* src/Makefile.am:
diff --git a/plparse/totem-disc.c b/plparse/totem-disc.c
index d8e306c75..6a2c7fcfc 100644
--- a/plparse/totem-disc.c
+++ b/plparse/totem-disc.c
@@ -285,6 +285,7 @@ cd_cache_new (const char *dev,
g_set_error (error, 0, 0,
_("Failed to find mountpoint for device %s"),
device);
+ g_free (device);
return NULL;
}
@@ -293,6 +294,7 @@ cd_cache_new (const char *dev,
if (!ctx) {
g_set_error (error, 0, 0,
_("Could not connect to the HAL daemon"));
+ g_free (device);
return NULL;
}
#endif
@@ -308,6 +310,8 @@ cd_cache_new (const char *dev,
cache->ctx = ctx;
#endif
+ g_free (device);
+
return cache;
}
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index 3a7fd9df5..9cea0865a 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -754,6 +754,8 @@ totem_pl_parser_finalize (GObject *object)
g_list_foreach (parser->priv->ignore_mimetypes, (GFunc) g_free, NULL);
g_list_free (parser->priv->ignore_mimetypes);
+ g_object_unref (parser->priv->pspec_pool);
+
g_free (parser->priv);
parser->priv = NULL;
@@ -1141,6 +1143,7 @@ totem_pl_parser_parse_internal (TotemPlParser *parser, const char *url,
DEBUG(g_print ("_get_mime_type_for_name for '%s' returned '%s'\n", url, mimetype));
if (mimetype == NULL || strcmp (GNOME_VFS_MIME_TYPE_UNKNOWN, mimetype) == 0) {
+ g_free (mimetype);
mimetype = my_gnome_vfs_get_mime_type_with_data (url, &data, parser);
DEBUG(g_print ("_get_mime_type_with_data for '%s' returned '%s'\n", url, mimetype ? mimetype : "NULL"));
}
@@ -1152,6 +1155,7 @@ totem_pl_parser_parse_internal (TotemPlParser *parser, const char *url,
if (strcmp (mimetype, EMPTY_FILE_TYPE) == 0) {
g_free (data);
+ g_free (mimetype);
return TOTEM_PL_PARSER_RESULT_SUCCESS;
}
diff --git a/src/ev-sidebar.c b/src/ev-sidebar.c
index eed906cd2..6d2f15e1f 100644
--- a/src/ev-sidebar.c
+++ b/src/ev-sidebar.c
@@ -208,7 +208,8 @@ ev_sidebar_new (void)
return ev_sidebar;
}
-const char *
+/* NOTE: Return values from this have to be g_free()d */
+char *
ev_sidebar_get_current_page (EvSidebar *ev_sidebar)
{
GtkTreeModel *model;
diff --git a/src/ev-sidebar.h b/src/ev-sidebar.h
index cd0f7b09a..5574c2ef1 100644
--- a/src/ev-sidebar.h
+++ b/src/ev-sidebar.h
@@ -64,7 +64,7 @@ void ev_sidebar_add_page (EvSidebar *ev_sidebar,
void ev_sidebar_set_current_page
(EvSidebar *ev_sidebar,
const char *page_id);
-const char *ev_sidebar_get_current_page
+char *ev_sidebar_get_current_page
(EvSidebar *ev_sidebar);
void ev_sidebar_remove_page (EvSidebar *ev_sidebar,
const gchar *page_id);
diff --git a/src/plugins/tracker/totem-tracker-widget.c b/src/plugins/tracker/totem-tracker-widget.c
index a16b76fc0..3814a737b 100644
--- a/src/plugins/tracker/totem-tracker-widget.c
+++ b/src/plugins/tracker/totem-tracker-widget.c
@@ -88,6 +88,8 @@ static void totem_tracker_widget_class_init (TotemTrackerWidgetClass *klass)
GObjectClass *object_class;
GtkWidgetClass *widget_class;
+ g_type_class_add_private (klass, sizeof (TotemTrackerWidgetPrivate));
+
parent_class = g_type_class_peek_parent (klass);
widget_class = GTK_WIDGET_CLASS (klass);
@@ -137,13 +139,12 @@ static void populate_result (TotemTrackerWidget *widget, char *result)
file_uri = gnome_vfs_get_uri_from_local_path (result);
thumbnail_path = gnome_thumbnail_path_for_uri (file_uri, GNOME_THUMBNAIL_SIZE_NORMAL);
- if (thumbnail_path != NULL) {
+ if (thumbnail_path != NULL)
thumbnail = gdk_pixbuf_new_from_file (thumbnail_path, NULL);
- }
gtk_list_store_set (GTK_LIST_STORE (widget->priv->result_store), &iter,
IMAGE_COLUMN, thumbnail,
- FILE_COLUMN, gnome_vfs_get_uri_from_local_path (result),
+ FILE_COLUMN, file_uri,
NAME_COLUMN, info->name,
-1);
@@ -151,7 +152,10 @@ static void populate_result (TotemTrackerWidget *widget, char *result)
g_free (file_uri);
}
else {
- /* FIXME Display an error */
+ /* Display an error */
+ char *message = g_strdup_printf (_("Could not get metadata for file %s."), result);
+ totem_interface_error_blocking (_("File Error"), message, NULL);
+ g_free (message);
}
g_free (info);
@@ -312,7 +316,7 @@ static void totem_tracker_widget_init (TotemTrackerWidget *widget)
GtkWidget *search_box; /* the search box contains the search entry and the search button */
GtkScrolledWindow *scroll; /* make the result list scrollable */
- widget->priv = g_new0 (TotemTrackerWidgetPrivate, 1);
+ widget->priv = G_TYPE_INSTANCE_GET_PRIVATE (widget, TOTEM_TYPE_TRACKER_WIDGET, TotemTrackerWidgetPrivate);
init_result_list (widget);
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 4aa0f248e..25ed7bb3c 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -1554,7 +1554,7 @@ totem_playlist_init (TotemPlaylist *playlist)
{
GtkWidget *container;
- playlist->_priv = g_new0 (TotemPlaylistPrivate, 1);
+ playlist->_priv = G_TYPE_INSTANCE_GET_PRIVATE (playlist, TOTEM_TYPE_PLAYLIST, TotemPlaylistPrivate);
playlist->_priv->parser = totem_pl_parser_new ();
totem_pl_parser_add_ignored_scheme (playlist->_priv->parser, "dvd:");
@@ -2338,6 +2338,8 @@ totem_playlist_class_init (TotemPlaylistClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ g_type_class_add_private (klass, sizeof (TotemPlaylistPrivate));
+
object_class->finalize = totem_playlist_finalize;
/* Signals */
diff --git a/src/totem-sidebar.c b/src/totem-sidebar.c
index d71bbbc90..9d53d2318 100644
--- a/src/totem-sidebar.c
+++ b/src/totem-sidebar.c
@@ -131,7 +131,7 @@ totem_sidebar_setup (Totem *totem, gboolean visible, const char *page_id)
gtk_widget_hide (totem->sidebar);
}
-const char *
+char *
totem_sidebar_get_current_page (Totem *totem)
{
return ev_sidebar_get_current_page (EV_SIDEBAR (totem->sidebar));
diff --git a/src/totem-sidebar.h b/src/totem-sidebar.h
index def4c4720..73a629195 100644
--- a/src/totem-sidebar.h
+++ b/src/totem-sidebar.h
@@ -30,7 +30,7 @@ void totem_sidebar_setup (Totem *totem, gboolean visible,
void totem_sidebar_toggle (Totem *totem, gboolean state);
void totem_sidebar_set_visibility (Totem *totem, gboolean visible);
gboolean totem_sidebar_is_visible (Totem *totem);
-const char *totem_sidebar_get_current_page (Totem *totem);
+char *totem_sidebar_get_current_page (Totem *totem);
void totem_sidebar_set_current_page (Totem *totem, const char *name);
G_END_DECLS
diff --git a/src/totem.c b/src/totem.c
index 10c33eae2..e701b7e32 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -235,6 +235,7 @@ totem_action_exit (Totem *totem)
if (totem->conn != NULL)
bacon_message_connection_free (totem->conn);
totem_action_save_state (totem, page_id);
+ g_free (page_id);
totem_sublang_exit (totem);
totem_destroy_file_filters ();