[gnome-settings-daemon/gnome-3-12] common: Fix possible crasher in device-mapper



commit 13de5cdb7f0485413dd51397487300e9a523c86b
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 28 18:42:44 2014 +0200

    common: Fix possible crasher in device-mapper
    
    Hardware:
    - laptop with built-in touchscreen
    - external display
    
    Reproducer:
    - Plug in external display
    - Disable laptop's builtin screen
    
    Backtrace:
     #0  0x00007ffff51f6c39 in raise () from /lib64/libc.so.6
     #1  0x00007ffff51f8348 in abort () from /lib64/libc.so.6
     #2  0x00007ffff5809f15 in g_assertion_message (domain=domain entry=0x7ffff73a62c2 "GnomeDesktop", 
file=file entry=0x7ffff73a7556 "gnome-rr.c", line=line entry=1709, func=func entry=0x7ffff73a7860 
<__FUNCTION__.56169> "gnome_rr_crtc_get_current_rotation", message=message entry=0xbfcc50 "assertion failed: 
(crtc != NULL)") at gtestutils.c:2291
     #3  0x00007ffff5809f9a in g_assertion_message_expr (domain=domain entry=0x7ffff73a62c2 "GnomeDesktop", 
file=file entry=0x7ffff73a7556 "gnome-rr.c", line=line entry=1709, func=func entry=0x7ffff73a7860 
<__FUNCTION__.56169> "gnome_rr_crtc_get_current_rotation", expr=expr entry=0x7ffff73a76c0 "crtc != NULL") at 
gtestutils.c:2306
     #4  0x00007ffff7392a82 in gnome_rr_crtc_get_current_rotation (crtc=<optimized out>) at gnome-rr.c:1709 
#5  0x00007fffe9758916 in input_info_get_matrix (matrix=0x7fffffffd210, input=0xbeee30) at 
gsd-device-mapper.c:620
     #6  input_info_remap (input=0xbeee30) at gsd-device-mapper.c:661
     #7  0x00007fffe9758d8d in mapper_apply_helper_info (mapper=mapper entry=0x863c60, helper=helper 
entry=0xc22fc0) at gsd-device-mapper.c:716
     #8  0x00007fffe9758f3c in mapper_recalculate_candidates (mapper=0x863c60) at gsd-device-mapper.c:741
     #9  _device_mapper_update_outputs (mapper=mapper entry=0x863c60) at gsd-device-mapper.c:990
     #10 0x00007fffe9758ffe in on_rr_screen_ready (object=<optimized out>, result=<optimized out>, 
user_data=user_data entry=0x863c60) at gsd-device-mapper.c:1019
     #11 0x00007ffff5da5ec5 in g_task_return_now (task=0x834ef0) at gtask.c:1076
     #12 0x00007ffff5da66a6 in g_task_return (task=0x834ef0, type=<optimized out>) at gtask.c:1129
     #13 0x00007ffff73937f1 in on_proxy_acquired (object=<optimized out>, result=<optimized out>, 
user_data=user_data entry=0x834ef0) at gnome-rr.c:632
     #14 0x00007ffff5d9605e in g_simple_async_result_complete (simple=0x86c780) at gsimpleasyncresult.c:763
     #15 0x00007ffff5d960cc in complete_in_idle_cb (data=0x86c780) at gsimpleasyncresult.c:775
     #16 0x00007ffff57e599e in g_main_dispatch (context=0x651170) at gmain.c:3067
     #17 g_main_context_dispatch (context=context entry=0x651170) at gmain.c:3677
     #18 0x00007ffff57e5d88 in g_main_context_iterate (context=0x651170, block=block entry=1, 
dispatch=dispatch entry=1, self=<optimized out>) at gmain.c:3748
     #19 0x00007ffff57e604a in g_main_loop_run (loop=0x678460) at gmain.c:3942
     #20 0x00007ffff6dc4e65 in gtk_main () at gtkmain.c:1192
     #21 0x00000000004036f7 in main (argc=1, argv=0x7fffffffd6c8) at main.c:444
    
    When setting up the internal display to be off, the device mapper will
    still try to find the crtc for a display that's turned off. Passing that
    invalid crtc to gnome_rr_crtc_get_current_rotation() will cause an
    assertion.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=729128

 plugins/common/gsd-device-mapper.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/common/gsd-device-mapper.c b/plugins/common/gsd-device-mapper.c
index 418c5e2..6949cac 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -598,10 +598,13 @@ input_info_get_matrix (GsdInputInfo *input,
                       float         matrix[NUM_ELEMS_MATRIX])
 {
        GsdOutputInfo *output;
+       GnomeRRCrtc *crtc;
 
        output = input_info_get_output (input);
+       if (output)
+               crtc = gnome_rr_output_get_crtc (output->output);
 
-       if (!output) {
+       if (!output || !crtc) {
                init_output_rotation_matrix (GNOME_RR_ROTATION_0, matrix);
        } else {
                GdkScreen *screen = gdk_screen_get_default ();
@@ -609,14 +612,12 @@ input_info_get_matrix (GsdInputInfo *input,
                float output_rot[NUM_ELEMS_MATRIX];
                GdkRectangle display, desktop = { 0 };
                GnomeRRRotation rotation;
-               GnomeRRCrtc *crtc;
                int monitor;
 
                g_debug ("Mapping '%s' to output '%s'",
                         gdk_device_get_name (input->device),
                         gnome_rr_output_get_name (output->output));
 
-               crtc = gnome_rr_output_get_crtc (output->output);
                rotation = gnome_rr_crtc_get_current_rotation (crtc);
                init_output_rotation_matrix (rotation, output_rot);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]