summaryrefslogtreecommitdiff
path: root/plugins/background/msd-background-manager.c
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-12-07 19:10:45 +0200
committerJasmine Hassan <[email protected]>2012-12-10 01:29:43 +0200
commitc257c330af9a2222442ea35eb6479008db80513b (patch)
treeaf6a42ad3959aa364f82ad3d2ef0a3cfb6534a07 /plugins/background/msd-background-manager.c
parent6beb0c21bd8cfab641a930ed7b33402407942f0f (diff)
downloadmate-settings-daemon-c257c330af9a2222442ea35eb6479008db80513b.tar.bz2
mate-settings-daemon-c257c330af9a2222442ea35eb6479008db80513b.tar.xz
[background] free priv->fade on stop
Diffstat (limited to 'plugins/background/msd-background-manager.c')
-rw-r--r--plugins/background/msd-background-manager.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index 3065464..3a3dd62 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -209,10 +209,12 @@ caja_is_drawing_background (MsdBackgroundManager *manager)
}
static void
-on_crossfade_finished (MsdBackgroundManager *manager)
+free_fade (MsdBackgroundManager *manager)
{
- g_object_unref (manager->priv->fade);
- manager->priv->fade = NULL;
+ if (manager->priv->fade != NULL) {
+ g_object_unref (manager->priv->fade);
+ manager->priv->fade = NULL;
+ }
}
static void
@@ -254,13 +256,14 @@ draw_background (MsdBackgroundManager *manager,
manager->priv->fade = mate_bg_set_surface_as_root_with_crossfade (screen,
surface);
g_signal_connect_swapped (manager->priv->fade, "finished",
- G_CALLBACK (on_crossfade_finished),
+ G_CALLBACK (free_fade),
manager);
} else {
mate_bg_set_surface_as_root (screen, surface);
}
cairo_surface_destroy (surface);
+ surface = NULL;
}
mate_settings_profile_end(NULL);
@@ -526,7 +529,7 @@ msd_background_manager_start (MsdBackgroundManager *manager,
void
msd_background_manager_stop (MsdBackgroundManager *manager)
{
- MsdBackgroundManagerPrivate* p = manager->priv;
+ MsdBackgroundManagerPrivate *p = manager->priv;
g_debug("Stopping background manager");
@@ -544,21 +547,23 @@ msd_background_manager_stop (MsdBackgroundManager *manager)
if (p->settings != NULL)
{
- g_object_unref(p->settings);
+ g_object_unref (G_OBJECT (p->settings));
p->settings = NULL;
}
if (p->timeout_id != 0)
{
- g_source_remove(p->timeout_id);
+ g_source_remove (p->timeout_id);
p->timeout_id = 0;
}
if (p->bg != NULL)
{
- g_object_unref(p->bg);
+ g_object_unref (G_OBJECT (p->bg));
p->bg = NULL;
}
+
+ free_fade (manager);
}
static GObject*
@@ -594,14 +599,12 @@ msd_background_manager_init (MsdBackgroundManager* manager)
static void
msd_background_manager_finalize (GObject* object)
{
- MsdBackgroundManager* background_manager;
-
- g_return_if_fail(object != NULL);
- g_return_if_fail(MSD_IS_BACKGROUND_MANAGER(object));
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (MSD_IS_BACKGROUND_MANAGER (object));
- background_manager = MSD_BACKGROUND_MANAGER(object);
+ MsdBackgroundManager *manager = MSD_BACKGROUND_MANAGER (object);
- g_return_if_fail(background_manager->priv != NULL);
+ g_return_if_fail (manager->priv != NULL);
G_OBJECT_CLASS(msd_background_manager_parent_class)->finalize(object);
}