|
|
79df40 |
From 8f2044e41222e2f5360f7ee7386d4ce0903ed786 Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
79df40 |
Date: Thu, 25 Jul 2019 01:14:37 +0200
|
|
|
79df40 |
Subject: [PATCH 12/28] clutter/stage-manager: Pause the master clock when all
|
|
|
79df40 |
stages have been removed
|
|
|
79df40 |
|
|
|
79df40 |
The clutter master clock is used by the stage during redraws, but never
|
|
|
79df40 |
stopped when the last stage is destroyed, potentially causing calls to dead
|
|
|
79df40 |
objects.
|
|
|
79df40 |
|
|
|
79df40 |
So, set it paused (destroying the underlying GSource) when the last stage is
|
|
|
79df40 |
disposed.
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
|
|
|
79df40 |
---
|
|
|
79df40 |
clutter/clutter/clutter-stage-manager.c | 8 ++++++++
|
|
|
79df40 |
1 file changed, 8 insertions(+)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/clutter/clutter/clutter-stage-manager.c b/clutter/clutter/clutter-stage-manager.c
|
|
|
79df40 |
index 3a44c8209..185e3e2ce 100644
|
|
|
79df40 |
--- a/clutter/clutter/clutter-stage-manager.c
|
|
|
79df40 |
+++ b/clutter/clutter/clutter-stage-manager.c
|
|
|
79df40 |
@@ -267,57 +267,65 @@ clutter_stage_manager_list_stages (ClutterStageManager *stage_manager)
|
|
|
79df40 |
/**
|
|
|
79df40 |
* clutter_stage_manager_peek_stages:
|
|
|
79df40 |
* @stage_manager: a #ClutterStageManager
|
|
|
79df40 |
*
|
|
|
79df40 |
* Lists all currently used stages.
|
|
|
79df40 |
*
|
|
|
79df40 |
* Return value: (transfer none) (element-type Clutter.Stage): a pointer
|
|
|
79df40 |
* to the internal list of #ClutterStage objects. The returned list
|
|
|
79df40 |
* is owned by the #ClutterStageManager and should never be modified
|
|
|
79df40 |
* or freed
|
|
|
79df40 |
*
|
|
|
79df40 |
* Since: 1.0
|
|
|
79df40 |
*/
|
|
|
79df40 |
const GSList *
|
|
|
79df40 |
clutter_stage_manager_peek_stages (ClutterStageManager *stage_manager)
|
|
|
79df40 |
{
|
|
|
79df40 |
return stage_manager->stages;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
_clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
|
|
|
79df40 |
ClutterStage *stage)
|
|
|
79df40 |
{
|
|
|
79df40 |
if (g_slist_find (stage_manager->stages, stage))
|
|
|
79df40 |
{
|
|
|
79df40 |
g_warning ("Trying to add a stage to the list of managed stages, "
|
|
|
79df40 |
"but it is already in it, aborting.");
|
|
|
79df40 |
return;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
+ _clutter_master_clock_set_paused (_clutter_master_clock_get_default (), FALSE);
|
|
|
79df40 |
+
|
|
|
79df40 |
g_object_ref_sink (stage);
|
|
|
79df40 |
|
|
|
79df40 |
stage_manager->stages = g_slist_append (stage_manager->stages, stage);
|
|
|
79df40 |
|
|
|
79df40 |
g_signal_emit (stage_manager, manager_signals[STAGE_ADDED], 0, stage);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
_clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
|
|
|
79df40 |
ClutterStage *stage)
|
|
|
79df40 |
{
|
|
|
79df40 |
/* this might be called multiple times from a ::dispose, so it
|
|
|
79df40 |
* needs to just return without warning
|
|
|
79df40 |
*/
|
|
|
79df40 |
if (!g_slist_find (stage_manager->stages, stage))
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
stage_manager->stages = g_slist_remove (stage_manager->stages, stage);
|
|
|
79df40 |
|
|
|
79df40 |
/* if the default stage is being destroyed then we unset the pointer */
|
|
|
79df40 |
if (default_stage == stage)
|
|
|
79df40 |
default_stage = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage);
|
|
|
79df40 |
|
|
|
79df40 |
g_object_unref (stage);
|
|
|
79df40 |
+
|
|
|
79df40 |
+ if (!stage_manager->stages)
|
|
|
79df40 |
+ {
|
|
|
79df40 |
+ ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
|
|
79df40 |
+ _clutter_master_clock_set_paused (master_clock, TRUE);
|
|
|
79df40 |
+ }
|
|
|
79df40 |
}
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|