summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2019-05-07 17:26:50 +0300
committermonsta <[email protected]>2019-05-20 16:03:37 +0300
commit5e2b2a876e481ef98ed8ebd75bfa656a60253571 (patch)
tree0aace8968cc22c7d97e61797895f93173ca9472d
parent985bd4ed7b4341aea9b85a232969140708150972 (diff)
downloadmate-panel-5e2b2a876e481ef98ed8ebd75bfa656a60253571.tar.bz2
mate-panel-5e2b2a876e481ef98ed8ebd75bfa656a60253571.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.c10
-rw-r--r--mate-panel/panel-toplevel.c84
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 d33c8324..c8e454ab 100644
--- a/mate-panel/panel-toplevel.c
+++ b/mate-panel/panel-toplevel.c
@@ -244,6 +244,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)
{
@@ -3070,6 +3072,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;
@@ -3078,6 +3111,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);
@@ -4216,47 +4259,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);
}