summaryrefslogtreecommitdiff
path: root/libmate-panel-applet
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-11-28 13:19:58 +0100
committerLuke from DC <[email protected]>2021-12-16 06:52:11 +0000
commit6fbabd51619c92bcd8584e1bb2f12f2b52904ea6 (patch)
tree540229310cf7f6d6b60e82fcd2952a6caec31a4a /libmate-panel-applet
parent94f3ec8c654363cd6a245eb9dca7c54f1b8f5649 (diff)
downloadmate-panel-6fbabd51619c92bcd8584e1bb2f12f2b52904ea6.tar.bz2
mate-panel-6fbabd51619c92bcd8584e1bb2f12f2b52904ea6.tar.xz
Use g_clear_pointer() and g_clear_object()
Diffstat (limited to 'libmate-panel-applet')
-rw-r--r--libmate-panel-applet/mate-panel-applet-factory.c5
-rw-r--r--libmate-panel-applet/mate-panel-applet.c33
2 files changed, 10 insertions, 28 deletions
diff --git a/libmate-panel-applet/mate-panel-applet-factory.c b/libmate-panel-applet/mate-panel-applet-factory.c
index c0465eb8..521ab4d4 100644
--- a/libmate-panel-applet/mate-panel-applet-factory.c
+++ b/libmate-panel-applet/mate-panel-applet-factory.c
@@ -78,10 +78,7 @@ mate_panel_applet_factory_finalize (GObject *object)
factories = NULL;
}
- if (factory->factory_id) {
- g_free (factory->factory_id);
- factory->factory_id = NULL;
- }
+ g_clear_pointer (&factory->factory_id, g_free);
if (factory->applets) {
g_hash_table_unref (factory->applets);
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index fc42554a..1a1751c6 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -845,36 +845,21 @@ mate_panel_applet_finalize (GObject *object)
g_dbus_connection_unregister_object (priv->connection,
priv->object_id);
priv->object_id = 0;
- g_object_unref (priv->connection);
- priv->connection = NULL;
+ g_clear_object (&priv->connection);
}
- if (priv->object_path) {
- g_free (priv->object_path);
- priv->object_path = NULL;
- }
+ g_clear_pointer (&priv->object_path, g_free);
mate_panel_applet_set_preferences_path (applet, NULL);
- if (priv->applet_action_group) {
- g_object_unref (priv->applet_action_group);
- priv->applet_action_group = NULL;
- }
-
- if (priv->panel_action_group) {
- g_object_unref (priv->panel_action_group);
- priv->panel_action_group = NULL;
- }
+ g_clear_object (&priv->applet_action_group);
+ g_clear_object (&priv->panel_action_group);
+ g_clear_object (&priv->ui_manager);
- if (priv->ui_manager) {
- g_object_unref (priv->ui_manager);
- priv->ui_manager = NULL;
- }
-
- g_free (priv->size_hints);
- g_free (priv->prefs_path);
- g_free (priv->background);
- g_free (priv->id);
+ g_clear_pointer (&priv->size_hints, g_free);
+ g_clear_pointer (&priv->prefs_path, g_free);
+ g_clear_pointer (&priv->background, g_free);
+ g_clear_pointer (&priv->id, g_free);
/* closure is owned by the factory */
priv->closure = NULL;