summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-05-14 17:22:41 +0200
committerGravatar waker <wakeroid@gmail.com>2011-05-14 17:22:41 +0200
commitf92aea56d89c1bfcb953a0fd57d07c08f65a53b1 (patch)
treed471b844d150593d557acbc5ba9bfa30183812f3
parenta36ac590553118cbeac7c7e1ccbeb405f1a8bf41 (diff)
fixed several memleaks in gtkui
-rw-r--r--playlist.c2
-rw-r--r--plugins/gtkui/ddbtabstrip.c14
-rw-r--r--plugins/gtkui/gtkui.c3
-rw-r--r--plugins/gtkui/mainplaylist.c7
-rw-r--r--plugins/gtkui/search.c4
5 files changed, 23 insertions, 7 deletions
diff --git a/playlist.c b/playlist.c
index cc2d896d..4fe6ed2d 100644
--- a/playlist.c
+++ b/playlist.c
@@ -145,6 +145,8 @@ pl_free (void) {
}
}
+ //fprintf (stderr, "\033[0;31mplt refc %d\033[37;0m\n", playlists_head->refc);
+
plt_remove (0);
}
plt_loading = 0;
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index f40c1ade..f8f3e6c4 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -47,10 +47,9 @@ plt_get_title_wrapper (int plt, char *buffer, int len) {
strcpy (buffer, "");
return;
}
- deadbeef->pl_lock ();
- void *p = deadbeef->plt_get_for_idx (plt);
+ ddb_playlist_t *p = deadbeef->plt_get_for_idx (plt);
deadbeef->plt_get_title (p, buffer, len);
- deadbeef->pl_unlock ();
+ deadbeef->plt_unref (p);
char *end;
if (!g_utf8_validate (buffer, -1, (const gchar **)&end)) {
*end = 0;
@@ -357,8 +356,9 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, GdkDrawable *drawable, int idx, int se
GdkColor clr;
int fallback = 1;
deadbeef->pl_lock ();
- void *plt = deadbeef->plt_get_for_idx (idx);
+ ddb_playlist_t *plt = deadbeef->plt_get_for_idx (idx);
const char *bgclr = deadbeef->plt_find_meta (plt, "gui.bgcolor");
+ deadbeef->plt_unref (plt);
if (bgclr) {
int r, g, b;
if (3 == sscanf (bgclr, "%02x%02x%02x", &r, &g, &b)) {
@@ -495,7 +495,7 @@ set_tab_text_color (int idx, int selected) {
return;
}
deadbeef->pl_lock ();
- void *plt = deadbeef->plt_get_for_idx (idx);
+ ddb_playlist_t *plt = deadbeef->plt_get_for_idx (idx);
int fallback = 1;
const char *clr = deadbeef->plt_find_meta (plt, "gui.color");
if (clr) {
@@ -506,6 +506,7 @@ set_tab_text_color (int idx, int selected) {
draw_set_fg_color (fg);
}
}
+ deadbeef->plt_unref (plt);
if (fallback) {
GdkColor color;
gtkui_get_tabstrip_text_color (&color);
@@ -697,8 +698,9 @@ on_rename_playlist1_activate (GtkMenuItem *menuitem,
if (res == GTK_RESPONSE_OK) {
const char *text = gtk_entry_get_text (GTK_ENTRY (e));
deadbeef->pl_lock ();
- void *p = deadbeef->plt_get_for_idx (tab_clicked);
+ ddb_playlist_t *p = deadbeef->plt_get_for_idx (tab_clicked);
deadbeef->plt_set_title (p, text);
+ deadbeef->plt_unref (p);
deadbeef->pl_unlock ();
}
gtk_widget_destroy (dlg);
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index f72c5165..ba84d0a7 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -915,8 +915,9 @@ gtkui_add_new_playlist (void) {
deadbeef->pl_lock ();
for (i = 0; i < cnt; i++) {
char t[100];
- void *plt = deadbeef->plt_get_for_idx (i);
+ ddb_playlist_t *plt = deadbeef->plt_get_for_idx (i);
deadbeef->plt_get_title (plt, t, sizeof (t));
+ deadbeef->plt_unref (plt);
if (!strcasecmp (t, name)) {
break;
}
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 12ec24cf..f04f9cb1 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -234,6 +234,10 @@ main_column_size_changed (DdbListview *listview, int col) {
void main_col_free_user_data (void *data) {
if (data) {
+ col_info_t *inf = data;
+ if (inf->format) {
+ free (inf->format);
+ }
free (data);
}
}
@@ -336,6 +340,9 @@ main_playlist_init (GtkWidget *widget) {
void
main_playlist_free (void) {
+ g_object_unref (play16_pixbuf);
+ g_object_unref (pause16_pixbuf);
+ g_object_unref (buffering16_pixbuf);
}
void
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
index d71b4cef..e3d46819 100644
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -306,6 +306,10 @@ search_column_size_changed (DdbListview *listview, int col) {
void search_col_free_user_data (void *data) {
if (data) {
+ col_info_t *inf = data;
+ if (inf->format) {
+ free (inf->format);
+ }
free (data);
}
}