treewide: Ensure memory is not disposed multiple times

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
Anton Lazarev
2024-01-26 18:46:24 -08:00
parent 8a464224a3
commit 51e74ef595
3 changed files with 14 additions and 12 deletions

View File

@@ -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);