diff options
author | monsta <[email protected]> | 2019-05-07 17:26:50 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2019-05-20 16:05:14 +0300 |
commit | 75b4b08fb22d9df832ccccb7f42042abb0d09372 (patch) | |
tree | 17802c5a12ebf7798cc6e99bf7bf03c24b362a46 | |
parent | a6c3a1f9da5ad849b3c235ff55b1273e5c336b92 (diff) | |
download | mate-panel-75b4b08fb22d9df832ccccb7f42042abb0d09372.tar.bz2 mate-panel-75b4b08fb22d9df832ccccb7f42042abb0d09372.tar.xz |
fix random crashes on panel reset
- unref objects in toplevel's dispose function instead of finalize
- disconnect from toplevel's GSettings objects before deleting them
-rw-r--r-- | mate-panel/panel-profile.c | 10 | ||||
-rw-r--r-- | mate-panel/panel-toplevel.c | 84 |
2 files changed, 43 insertions, 51 deletions
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index 15cf114e..79415460 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -1029,16 +1029,6 @@ panel_profile_delete_toplevel (PanelToplevel *toplevel) toplevel_id = panel_profile_get_toplevel_id (toplevel); - /* disable GSettings signals */ - if (toplevel->settings) { - g_object_unref (toplevel->settings); - toplevel->settings = NULL; - } - if (toplevel->background_settings) { - g_object_unref (toplevel->background_settings); - toplevel->background_settings = NULL; - } - panel_profile_delete_toplevel_objects (toplevel_id); panel_profile_remove_from_list (PANEL_GSETTINGS_TOPLEVELS, toplevel_id); diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 0b338d07..83dfd59d 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -246,6 +246,8 @@ static void panel_toplevel_calculate_animation_end_geometry(PanelToplevel *tople static void panel_toplevel_update_monitor(PanelToplevel* toplevel); static void panel_toplevel_set_monitor_internal(PanelToplevel* toplevel, int monitor, gboolean force_resize); +static void panel_toplevel_drag_threshold_changed (PanelToplevel *toplevel); + static void update_style_classes (PanelToplevel *toplevel) { @@ -3102,6 +3104,37 @@ panel_toplevel_dispose (GObject *widget) { PanelToplevel *toplevel = (PanelToplevel *) widget; + if (toplevel->priv->settings_path) { + g_free (toplevel->priv->settings_path); + toplevel->priv->settings_path = NULL; + } + + if (toplevel->settings) { + g_signal_handlers_disconnect_by_data (toplevel->settings, toplevel); + g_object_unref (toplevel->settings); + toplevel->settings = NULL; + } + + if (toplevel->queued_settings) { + g_object_unref (toplevel->queued_settings); + toplevel->queued_settings = NULL; + } + + if (toplevel->background_settings) { + g_signal_handlers_disconnect_by_data (toplevel->background_settings, toplevel); + g_object_unref (toplevel->background_settings); + toplevel->background_settings = NULL; + } + + if (toplevel->priv->gtk_settings) { + g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings, + G_CALLBACK (panel_toplevel_drag_threshold_changed), + toplevel); + toplevel->priv->gtk_settings = NULL; + + panel_background_free (&toplevel->background); + } + if (toplevel->priv->attached) { panel_toplevel_disconnect_attached (toplevel); toplevel->priv->attached = FALSE; @@ -3110,6 +3143,16 @@ panel_toplevel_dispose (GObject *widget) toplevel->priv->attach_widget = NULL; } + if (toplevel->priv->description) { + g_free (toplevel->priv->description); + toplevel->priv->description = NULL; + } + + if (toplevel->priv->name) { + g_free (toplevel->priv->name); + toplevel->priv->name = NULL; + } + panel_toplevel_disconnect_timeouts (toplevel); G_OBJECT_CLASS (panel_toplevel_parent_class)->dispose (widget); @@ -4252,47 +4295,6 @@ panel_toplevel_finalize (GObject *object) toplevel_list = g_slist_remove (toplevel_list, toplevel); - if (toplevel->priv->settings_path) { - g_free (toplevel->priv->settings_path); - toplevel->priv->settings_path = NULL; - } - - if (toplevel->settings) { - g_object_unref (toplevel->settings); - toplevel->settings = NULL; - } - - if (toplevel->background_settings) { - g_object_unref (toplevel->background_settings); - toplevel->background_settings = NULL; - } - - if (toplevel->priv->gtk_settings) { - g_signal_handlers_disconnect_by_func (toplevel->priv->gtk_settings, - G_CALLBACK (panel_toplevel_drag_threshold_changed), - toplevel); - toplevel->priv->gtk_settings = NULL; - - panel_background_free (&toplevel->background); - } - - if (toplevel->priv->attached) { - panel_toplevel_disconnect_attached (toplevel); - - toplevel->priv->attached = FALSE; - - toplevel->priv->attach_toplevel = NULL; - toplevel->priv->attach_widget = NULL; - } - - if (toplevel->priv->description) - g_free (toplevel->priv->description); - toplevel->priv->description = NULL; - - if (toplevel->priv->name) - g_free (toplevel->priv->name); - toplevel->priv->name = NULL; - G_OBJECT_CLASS (panel_toplevel_parent_class)->finalize (object); } |