|
|
9501a8 |
From 23c81629d775fd902e4bee7ec0a182a916f4252b Mon Sep 17 00:00:00 2001
|
|
|
9501a8 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
9501a8 |
Date: Mon, 16 Sep 2019 16:17:48 +0200
|
|
|
9501a8 |
Subject: [PATCH 1/3] idle-monitor: Make helper function static
|
|
|
9501a8 |
|
|
|
9501a8 |
It wasn't used outside the file, so no reason to not have it static.
|
|
|
9501a8 |
|
|
|
9501a8 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
|
|
|
9501a8 |
---
|
|
|
9501a8 |
src/backends/meta-idle-monitor-private.h | 1 -
|
|
|
9501a8 |
src/backends/meta-idle-monitor.c | 8 ++++----
|
|
|
9501a8 |
2 files changed, 4 insertions(+), 5 deletions(-)
|
|
|
9501a8 |
|
|
|
9501a8 |
diff --git a/src/backends/meta-idle-monitor-private.h b/src/backends/meta-idle-monitor-private.h
|
|
|
9501a8 |
index 82f3f87b7..9ce7e743a 100644
|
|
|
9501a8 |
--- a/src/backends/meta-idle-monitor-private.h
|
|
|
9501a8 |
+++ b/src/backends/meta-idle-monitor-private.h
|
|
|
9501a8 |
@@ -54,7 +54,6 @@ struct _MetaIdleMonitorClass
|
|
|
9501a8 |
GObjectClass parent_class;
|
|
|
9501a8 |
};
|
|
|
9501a8 |
|
|
|
9501a8 |
-void _meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch);
|
|
|
9501a8 |
void meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor);
|
|
|
9501a8 |
|
|
|
9501a8 |
#endif /* META_IDLE_MONITOR_PRIVATE_H */
|
|
|
9501a8 |
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
index 2c06ee73c..ce1b87bbb 100644
|
|
|
9501a8 |
--- a/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
+++ b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
@@ -54,8 +54,8 @@ static GParamSpec *obj_props[PROP_LAST];
|
|
|
9501a8 |
|
|
|
9501a8 |
G_DEFINE_TYPE (MetaIdleMonitor, meta_idle_monitor, G_TYPE_OBJECT)
|
|
|
9501a8 |
|
|
|
9501a8 |
-void
|
|
|
9501a8 |
-_meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
|
|
|
9501a8 |
+static void
|
|
|
9501a8 |
+meta_idle_monitor_watch_fire (MetaIdleMonitorWatch *watch)
|
|
|
9501a8 |
{
|
|
|
9501a8 |
MetaIdleMonitor *monitor;
|
|
|
9501a8 |
guint id;
|
|
|
9501a8 |
@@ -319,7 +319,7 @@ idle_monitor_dispatch_timeout (GSource *source,
|
|
|
9501a8 |
if (ready_time > now)
|
|
|
9501a8 |
return G_SOURCE_CONTINUE;
|
|
|
9501a8 |
|
|
|
9501a8 |
- _meta_idle_monitor_watch_fire (watch);
|
|
|
9501a8 |
+ meta_idle_monitor_watch_fire (watch);
|
|
|
9501a8 |
g_source_set_ready_time (watch->timeout_source, -1);
|
|
|
9501a8 |
|
|
|
9501a8 |
return G_SOURCE_CONTINUE;
|
|
|
9501a8 |
@@ -506,7 +506,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor)
|
|
|
9501a8 |
|
|
|
9501a8 |
if (watch->timeout_msec == 0)
|
|
|
9501a8 |
{
|
|
|
9501a8 |
- _meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
|
|
|
9501a8 |
+ meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
|
|
|
9501a8 |
}
|
|
|
9501a8 |
else
|
|
|
9501a8 |
{
|
|
|
9501a8 |
--
|
|
|
9501a8 |
2.23.0
|
|
|
9501a8 |
|
|
|
9501a8 |
|
|
|
9501a8 |
From 0d43bbdae0a08c7618e789fa0d5270615c907a36 Mon Sep 17 00:00:00 2001
|
|
|
9501a8 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
9501a8 |
Date: Mon, 16 Sep 2019 16:36:05 +0200
|
|
|
9501a8 |
Subject: [PATCH 2/3] idle-monitor: Remove redundant type cast
|
|
|
9501a8 |
|
|
|
9501a8 |
No need to type cast a `MetaIdleMonitorWatch *` to a
|
|
|
9501a8 |
`MetaIdleMonitorWatch *`.
|
|
|
9501a8 |
|
|
|
9501a8 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
|
|
|
9501a8 |
---
|
|
|
9501a8 |
src/backends/meta-idle-monitor.c | 2 +-
|
|
|
9501a8 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
9501a8 |
|
|
|
9501a8 |
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
index ce1b87bbb..3dbb89944 100644
|
|
|
9501a8 |
--- a/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
+++ b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
@@ -506,7 +506,7 @@ meta_idle_monitor_reset_idletime (MetaIdleMonitor *monitor)
|
|
|
9501a8 |
|
|
|
9501a8 |
if (watch->timeout_msec == 0)
|
|
|
9501a8 |
{
|
|
|
9501a8 |
- meta_idle_monitor_watch_fire ((MetaIdleMonitorWatch *) watch);
|
|
|
9501a8 |
+ meta_idle_monitor_watch_fire (watch);
|
|
|
9501a8 |
}
|
|
|
9501a8 |
else
|
|
|
9501a8 |
{
|
|
|
9501a8 |
--
|
|
|
9501a8 |
2.23.0
|
|
|
9501a8 |
|
|
|
9501a8 |
|
|
|
9501a8 |
From f6c24dd45c14dd16d6878ebf170f8468ad3d47e1 Mon Sep 17 00:00:00 2001
|
|
|
9501a8 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
9501a8 |
Date: Mon, 16 Sep 2019 16:36:51 +0200
|
|
|
9501a8 |
Subject: [PATCH 3/3] idle-monitor: Reset timeout before firing watch
|
|
|
9501a8 |
|
|
|
9501a8 |
The watch might be removed during firing, meaning the source is
|
|
|
9501a8 |
destroyed after returning. Avoid use-after-free by unsetting the timeout
|
|
|
9501a8 |
before firing. Returning G_SOURCE_CONTINUE in that case is harmless, as
|
|
|
9501a8 |
source is destroyed.
|
|
|
9501a8 |
|
|
|
9501a8 |
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/796
|
|
|
9501a8 |
|
|
|
9501a8 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
|
|
|
9501a8 |
---
|
|
|
9501a8 |
src/backends/meta-idle-monitor.c | 3 ++-
|
|
|
9501a8 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9501a8 |
|
|
|
9501a8 |
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
index 3dbb89944..c6e814468 100644
|
|
|
9501a8 |
--- a/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
+++ b/src/backends/meta-idle-monitor.c
|
|
|
9501a8 |
@@ -319,9 +319,10 @@ idle_monitor_dispatch_timeout (GSource *source,
|
|
|
9501a8 |
if (ready_time > now)
|
|
|
9501a8 |
return G_SOURCE_CONTINUE;
|
|
|
9501a8 |
|
|
|
9501a8 |
- meta_idle_monitor_watch_fire (watch);
|
|
|
9501a8 |
g_source_set_ready_time (watch->timeout_source, -1);
|
|
|
9501a8 |
|
|
|
9501a8 |
+ meta_idle_monitor_watch_fire (watch);
|
|
|
9501a8 |
+
|
|
|
9501a8 |
return G_SOURCE_CONTINUE;
|
|
|
9501a8 |
}
|
|
|
9501a8 |
|
|
|
9501a8 |
--
|
|
|
9501a8 |
2.23.0
|
|
|
9501a8 |
|