mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-04 20:07:36 +00:00
treewide: Ensure memory is not disposed multiple times
Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
parent
8a464224a3
commit
51e74ef595
3 changed files with 14 additions and 12 deletions
|
@ -69,8 +69,6 @@ struct _CallsAccountOverview {
|
|||
GtkWidget *current_account_widget;
|
||||
|
||||
/* models */
|
||||
GtkFilter *account_provider_filter;
|
||||
GtkFilter *account_filter;
|
||||
GListModel *providers;
|
||||
GListModel *accounts;
|
||||
|
||||
|
@ -333,10 +331,8 @@ calls_account_overview_dispose (GObject *object)
|
|||
CallsAccountOverview *self = CALLS_ACCOUNT_OVERVIEW (object);
|
||||
|
||||
g_clear_object (&self->providers);
|
||||
g_clear_object (&self->account_provider_filter);
|
||||
|
||||
g_clear_object (&self->accounts);
|
||||
g_clear_object (&self->account_filter);
|
||||
|
||||
g_clear_object (&self->key_controller);
|
||||
g_clear_object (&self->key_controller_account);
|
||||
|
@ -393,6 +389,9 @@ match_account (gpointer item,
|
|||
static void
|
||||
calls_account_overview_init (CallsAccountOverview *self)
|
||||
{
|
||||
GtkFilter *account_provider_filter;
|
||||
GtkFilter *account_filter;
|
||||
|
||||
GListModel *all_providers =
|
||||
calls_plugin_manager_get_providers (calls_plugin_manager_get_default ());
|
||||
GListModel *all_origins =
|
||||
|
@ -400,10 +399,9 @@ calls_account_overview_init (CallsAccountOverview *self)
|
|||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->account_provider_filter = GTK_FILTER (gtk_custom_filter_new (match_account_provider, NULL, NULL));
|
||||
account_provider_filter = GTK_FILTER (gtk_custom_filter_new (match_account_provider, NULL, NULL));
|
||||
self->providers =
|
||||
G_LIST_MODEL (gtk_filter_list_model_new (all_providers,
|
||||
self->account_provider_filter));
|
||||
G_LIST_MODEL (gtk_filter_list_model_new (all_providers, account_provider_filter));
|
||||
|
||||
g_signal_connect (self->providers,
|
||||
"items-changed",
|
||||
|
@ -413,10 +411,9 @@ calls_account_overview_init (CallsAccountOverview *self)
|
|||
0, 0, g_list_model_get_n_items (self->providers),
|
||||
self);
|
||||
|
||||
self->account_filter = GTK_FILTER (gtk_custom_filter_new (match_account, NULL, NULL));
|
||||
account_filter = GTK_FILTER (gtk_custom_filter_new (match_account, NULL, NULL));
|
||||
self->accounts =
|
||||
G_LIST_MODEL (gtk_filter_list_model_new (all_origins,
|
||||
self->account_filter));
|
||||
G_LIST_MODEL (gtk_filter_list_model_new (all_origins, account_filter));
|
||||
g_signal_connect_object (self->accounts,
|
||||
"items-changed",
|
||||
G_CALLBACK (on_accounts_changed),
|
||||
|
|
|
@ -447,7 +447,6 @@ calls_manager_finalize (GObject *object)
|
|||
{
|
||||
CallsManager *self = CALLS_MANAGER (object);
|
||||
|
||||
g_clear_object (&self->origins);
|
||||
g_clear_object (&self->contacts_provider);
|
||||
|
||||
G_OBJECT_CLASS (calls_manager_parent_class)->finalize (object);
|
||||
|
|
|
@ -162,8 +162,14 @@ calls_plugin_manager_dispose (GObject *object)
|
|||
{
|
||||
CallsPluginManager *self = CALLS_PLUGIN_MANAGER (object);
|
||||
|
||||
guint n = g_list_model_get_n_items (G_LIST_MODEL (self->plugins));
|
||||
for (guint i = 0; i < n; i++) {
|
||||
// The manager will be disposed immediately; don't let unloaded plugins callback to it
|
||||
g_autoptr (CallsPlugin) plugin = g_list_model_get_item (G_LIST_MODEL (self->plugins), i);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin), G_CALLBACK (on_plugin_loaded), self);
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->plugins, unload_and_free_plugins);
|
||||
g_clear_object (&self->providers);
|
||||
g_clear_object (&self->plugin_engine);
|
||||
|
||||
G_OBJECT_CLASS (calls_plugin_manager_parent_class)->dispose (object);
|
||||
|
|
Loading…
Reference in a new issue