[gnome-settings-daemon/rhel-6.9: 22/25] xrandr: Avoid crash when Fn+F7 is pressed on some systems
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/rhel-6.9: 22/25] xrandr: Avoid crash when Fn+F7 is pressed on some systems
- Date: Wed, 8 Feb 2017 20:48:14 +0000 (UTC)
commit fb3404293722c4063007d314f864793e44d82fbc
Author: Bastien Nocera <hadess hadess net>
Date: Wed Nov 18 14:28:58 2015 +0100
xrandr: Avoid crash when Fn+F7 is pressed on some systems
When a display driver doesn't support XRandR properly,
manager->priv->rw_screen will be NULL. However, because of the way that
we need to initialise D-Bus, some of the API is still accessible.
As such, the "Fn+F7" (update screen) shortcut would access API that
should only be accessible when XRandR is available. Add guards to those
functions.
https://bugzilla.redhat.com/show_bug.cgi?id=1196044
plugins/xrandr/gsd-xrandr-manager.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 6e3aa36..db95e28 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -412,6 +412,8 @@ static gboolean
gsd_xrandr_manager_apply_configuration (GsdXrandrManager *manager,
GError **error)
{
+ if (manager->priv->rw_screen == NULL)
+ return FALSE;
return try_to_apply_intended_configuration (manager, NULL, GDK_CURRENT_TIME, error);
}
@@ -425,6 +427,9 @@ gsd_xrandr_manager_2_apply_configuration (GsdXrandrManager *manager,
GdkWindow *parent_window;
gboolean result;
+ if (manager->priv->rw_screen == NULL)
+ return FALSE;
+
if (parent_window_id != 0)
parent_window = gdk_window_foreign_new_for_display (gdk_display_get_default (),
(GdkNativeWindow) parent_window_id);
else
@@ -444,6 +449,8 @@ gsd_xrandr_manager_2_video_mode_switch (GsdXrandrManager *manager,
guint32 timestamp,
GError **error)
{
+ if (manager->priv->rw_screen == NULL)
+ return FALSE;
handle_fn_f7 (manager, timestamp);
return TRUE;
}
@@ -454,6 +461,8 @@ gsd_xrandr_manager_2_rotate (GsdXrandrManager *manager,
guint32 timestamp,
GError **error)
{
+ if (manager->priv->rw_screen == NULL)
+ return FALSE;
//handle_rotate_windows (manager, timestamp);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]