From: Vladimir Nadvornik Date: Fri, 28 Aug 2009 23:09:05 +0000 (+0000) Subject: fixed vd_notify_cb leak X-Git-Tag: v1.0.0~73 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=2b239ea29ca6de434c05482d27abf55df26d35f0 fixed vd_notify_cb leak --- diff --git a/src/filedata.c b/src/filedata.c index 1397998d..1d2bb1f6 100644 --- a/src/filedata.c +++ b/src/filedata.c @@ -2549,6 +2549,19 @@ static gint file_data_notify_sort(gconstpointer a, gconstpointer b) gboolean file_data_register_notify_func(FileDataNotifyFunc func, gpointer data, NotifyPriority priority) { NotifyData *nd; + GList *work = notify_func_list; + + while (work) + { + NotifyData *nd = (NotifyData *)work->data; + + if (nd->func == func && nd->data == data) + { + g_warning("Notify func already registered"); + return FALSE; + } + work = work->next; + } nd = g_new(NotifyData, 1); nd->func = func; @@ -2579,6 +2592,7 @@ gboolean file_data_unregister_notify_func(FileDataNotifyFunc func, gpointer data work = work->next; } + g_warning("Notify func not found"); return FALSE; } diff --git a/src/view_dir.c b/src/view_dir.c index 5ba30775..7c5cd18c 100644 --- a/src/view_dir.c +++ b/src/view_dir.c @@ -126,10 +126,11 @@ ViewDir *vd_new(DirViewType type, FileData *dir_fd) g_signal_connect(G_OBJECT(vd->view), "button_release_event", G_CALLBACK(vd_release_cb), vd); - if (dir_fd) vd_set_fd(vd, dir_fd); - file_data_register_notify_func(vd_notify_cb, vd, NOTIFY_PRIORITY_HIGH); + /* vd_set_fd expects that vd_notify_cb is already registered */ + if (dir_fd) vd_set_fd(vd, dir_fd); + gtk_widget_show(vd->view); return vd;