Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:jberkman
evolution-data-server-2.6
fix-eds-bnc-222908-memleak.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-eds-bnc-222908-memleak.diff of Package evolution-data-server-2.6
--- addressbook/libebook/e-book-view-listener-copy.c 2006-11-21 15:14:57.000000000 +0530 +++ addressbook/libebook/e-book-view-listener.c 2006-11-21 15:18:51.000000000 +0530 @@ -349,10 +349,16 @@ e_book_view_listener_dispose (GObject *o d(printf ("%p: in e_book_view_listener_dispose (%p)\n", g_thread_self(), object)); if (listener->priv) { + EBookViewListenerResponse *response; + if (listener->priv->idle_id != -1) g_source_remove (listener->priv->idle_id); g_mutex_free (listener->priv->idle_mutex); + + /*Free Pending Events */ + while ((response = g_async_queue_try_pop (listener->priv->queue)) != NULL) + free_response (response); g_async_queue_unref (listener->priv->queue); --- addressbook/libebook/e-book-copy.c 2006-11-21 15:19:35.000000000 +0530 +++ addressbook/libebook/e-book.c 2006-11-21 15:21:53.000000000 +0530 @@ -3319,6 +3319,8 @@ fetch_corba_book (EBook *book, for (l = factories; l; l = l->next) CORBA_Object_release ((CORBA_Object)l->data, NULL); + g_list_free (factories); + if (rv == TRUE) { book->priv->corba_book = corba_book; book->priv->comp_listener = e_component_listener_new (book->priv->corba_book); --- libedataserverui/e-contact-store-copy.c 2006-11-21 15:32:48.000000000 +0530 +++ libedataserverui/e-contact-store.c 2006-11-21 15:35:07.000000000 +0530 @@ -73,8 +73,6 @@ static gboolean e_contact_store_iter GtkTreeIter *iter, GtkTreeIter *child); -static void stop_view (EContactStore *contact_store, EBookView *view); - typedef struct { EBook *book; @@ -87,6 +85,10 @@ typedef struct } ContactSource; +static void free_contact_ptrarray (GPtrArray *contacts); +static void clear_contact_source (EContactStore *contact_store, ContactSource *source); +static void stop_view (EContactStore *contact_store, EBookView *view); + /* ------------------ * * Class/object setup * * ------------------ */ @@ -168,7 +170,23 @@ e_contact_store_init (EContactStore *con static void e_contact_store_finalize (GObject *object) { - /* TODO: Free stuff */ + EContactStore *contact_store = E_CONTACT_STORE (object); + gint i; + + /* Free sources and cached contacts */ + + for (i = 0; i < contact_store->contact_sources->len; i++) { + ContactSource *source = &g_array_index (contact_store->contact_sources, ContactSource, i); + + clear_contact_source (contact_store, source); + + free_contact_ptrarray (source->contacts); + g_object_unref (source->book); + } + + g_array_free (contact_store->contact_sources, TRUE); + if (contact_store->query) + e_book_query_unref (contact_store->query); if (G_OBJECT_CLASS (parent_class)->finalize) (* G_OBJECT_CLASS (parent_class)->finalize) (object); --- libedataserverui/e-destination-store-copy.c 2006-11-21 15:37:24.000000000 +0530 +++ libedataserverui/e-destination-store.c 2006-11-21 15:39:21.000000000 +0530 @@ -74,6 +74,7 @@ static gboolean e_destination_store_ GtkTreeIter *child); static void destination_changed (EDestinationStore *destination_store, EDestination *destination); +static void stop_destination (EDestinationStore *destination_store, EDestination *destination); /* ------------------ * * Class/object setup * @@ -160,7 +161,17 @@ e_destination_store_init (EDestinationSt static void e_destination_store_finalize (GObject *object) { - /* TODO: Free stuff */ + EDestinationStore *destination_store = E_DESTINATION_STORE (object); + gint i; + + for (i = 0; i < destination_store->destinations->len; i++) { + EDestination *destination = g_ptr_array_index (destination_store->destinations, i); + + stop_destination (destination_store, destination); + g_object_unref (destination); + } + + g_ptr_array_free (destination_store->destinations, TRUE); if (G_OBJECT_CLASS (parent_class)->finalize) (* G_OBJECT_CLASS (parent_class)->finalize) (object); --- libedataserverui/e-name-selector-dialog-copy.c 2006-11-21 15:40:55.000000000 +0530 +++ libedataserverui/e-name-selector-dialog.c 2006-11-21 15:49:10.000000000 +0530 @@ -66,6 +66,7 @@ static void source_selected static void transfer_button_clicked (ENameSelectorDialog *name_selector_dialog, GtkButton *transfer_button); static void contact_selection_changed (ENameSelectorDialog *name_selector_dialog); static void setup_name_selector_model (ENameSelectorDialog *name_selector_dialog); +static void shutdown_name_selector_model (ENameSelectorDialog *name_selector_dialog); static void contact_activated (ENameSelectorDialog *name_selector_dialog, GtkTreePath *path); static void destination_activated (ENameSelectorDialog *name_selector_dialog, GtkTreePath *path, GtkTreeViewColumn *column, GtkTreeView *tree_view); @@ -291,11 +292,9 @@ e_name_selector_dialog_dispose (GObject { ENameSelectorDialog *name_selector_dialog = E_NAME_SELECTOR_DIALOG (object); - g_signal_handlers_disconnect_matched (name_selector_dialog->name_selector_model, - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, - name_selector_dialog); remove_books (name_selector_dialog); + shutdown_name_selector_model (name_selector_dialog); if (G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->dispose) G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->dispose (object); @@ -305,7 +304,11 @@ e_name_selector_dialog_dispose (GObject static void e_name_selector_dialog_finalize (GObject *object) { - /* TODO: Free stuff */ + ENameSelectorDialog *name_selector_dialog = E_NAME_SELECTOR_DIALOG (object); + + g_array_free (name_selector_dialog->sections, TRUE); + g_object_unref (name_selector_dialog->source_list); + g_object_unref (name_selector_dialog->button_size_group); g_list_free (category_list); if (G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->finalize) @@ -419,6 +422,9 @@ remove_books (ENameSelectorDialog *name_ GList *books; GList *l; + if (!name_selector_dialog->name_selector_model) + return; + contact_store = e_name_selector_model_peek_contact_store (name_selector_dialog->name_selector_model); /* Remove books (should be just one) being viewed */ @@ -1040,14 +1046,6 @@ setup_name_selector_model (ENameSelector ETreeModelGenerator *contact_filter; GList *new_sections; GList *l; - gint i; - - /* Rid UI of previous destination sections */ - - for (i = 0; i < name_selector_dialog->sections->len; i++) - free_section (name_selector_dialog, i); - - g_array_set_size (name_selector_dialog->sections, 0); /* Create new destination sections in UI */ @@ -1083,9 +1081,6 @@ setup_name_selector_model (ENameSelector /* Create sorting model on top of filter, assign it to view */ - if (name_selector_dialog->contact_sort) - g_object_unref (name_selector_dialog->contact_sort); - name_selector_dialog->contact_sort = GTK_TREE_MODEL_SORT ( gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (contact_filter))); @@ -1103,6 +1098,36 @@ setup_name_selector_model (ENameSelector } static void +shutdown_name_selector_model (ENameSelectorDialog *name_selector_dialog) +{ + gint i; + + /* Rid UI of previous destination sections */ + + for (i = 0; i < name_selector_dialog->sections->len; i++) + free_section (name_selector_dialog, i); + + g_array_set_size (name_selector_dialog->sections, 0); + + /* Free sorting model */ + + if (name_selector_dialog->contact_sort) { + g_object_unref (name_selector_dialog->contact_sort); + name_selector_dialog->contact_sort = NULL; + } + + /* Free backend model */ + + if (name_selector_dialog->name_selector_model) { + g_signal_handlers_disconnect_matched (name_selector_dialog->name_selector_model, + G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, name_selector_dialog); + + g_object_unref (name_selector_dialog->name_selector_model); + name_selector_dialog->name_selector_model = NULL; + } +} + +static void deep_free_list (GList *list) { GList *l; @@ -1219,10 +1244,7 @@ e_name_selector_dialog_set_model (ENameS if (model == name_selector_dialog->name_selector_model) return; - g_signal_handlers_disconnect_matched (name_selector_dialog->name_selector_model, - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, name_selector_dialog); - - g_object_unref (name_selector_dialog->name_selector_model); + shutdown_name_selector_model (name_selector_dialog); name_selector_dialog->name_selector_model = g_object_ref (model); setup_name_selector_model (name_selector_dialog); --- libedataserverui/e-name-selector-model-copy.c 2006-11-21 15:51:45.000000000 +0530 +++ libedataserverui/e-name-selector-model.c 2006-11-21 15:53:53.000000000 +0530 @@ -43,6 +43,7 @@ static gint generate_contact_rows (ECon static void override_email_address (EContactStore *contact_store, GtkTreeIter *iter, gint permutation_n, gint column, GValue *value, ENameSelectorModel *name_selector_model); +static void free_section (ENameSelectorModel *name_selector_model, gint n); /* ------------------ * * Class/object setup * @@ -84,11 +85,17 @@ static void e_name_selector_model_finalize (GObject *object) { ENameSelectorModel *name_selector_model = E_NAME_SELECTOR_MODEL (object); + gint i; - /* TODO: Free sections */ - + for (i = 0; i < name_selector_model->sections->len; i++) + free_section (name_selector_model, i); + + g_array_free (name_selector_model->sections, TRUE); g_object_unref (name_selector_model->contact_filter); + if (name_selector_model->destination_uid_hash) + g_hash_table_destroy (name_selector_model->destination_uid_hash); + if (G_OBJECT_CLASS (e_name_selector_model_parent_class)->finalize) G_OBJECT_CLASS (e_name_selector_model_parent_class)->finalize (object); } --- libedataserverui/test-name-selector-copy.c 2006-11-21 15:55:34.000000000 +0530 +++ libedataserverui/test-name-selector.c 2006-11-21 15:57:05.000000000 +0530 @@ -31,20 +31,22 @@ #include <gtk/gtk.h> #include <camel/camel.h> +ENameSelectorDialog *name_selector_dialog; +GtkWidget *name_selector_entry_window; + static void close_dialog (GtkWidget *widget, int response, gpointer data) { - GtkWidget *dialog = data; - - gtk_widget_destroy (dialog); - gtk_main_quit (); + gtk_widget_destroy (GTK_WIDGET (name_selector_dialog)); + gtk_widget_destroy (name_selector_entry_window); + + g_timeout_add (4000, (GSourceFunc) gtk_main_quit, NULL); } static gboolean start_test (void) { ENameSelectorModel *name_selector_model; - ENameSelectorDialog *name_selector_dialog; ENameSelectorEntry *name_selector_entry; EDestinationStore *destination_store; GtkWidget *container; @@ -70,6 +72,8 @@ start_test (void) gtk_container_add (GTK_CONTAINER (container), GTK_WIDGET (name_selector_entry)); gtk_widget_show_all (container); + name_selector_entry_window = container; + g_object_unref (name_selector_model); g_object_unref (destination_store); return FALSE;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor