[gnome-settings-daemon] common: Fix 2 possible initialization warnings in GsdDeviceMapper



commit b5aa72e7837d54561877c42ee59cf819fb38bd54
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 16 13:27:03 2014 +0200

    common: Fix 2 possible initialization warnings in GsdDeviceMapper
    
    If a plugin got to register, and query the output of a device before
    the mapper is initialized, 2 warnings could happen when hitting NULL
    pointers.

 plugins/common/gsd-device-mapper.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/common/gsd-device-mapper.c b/plugins/common/gsd-device-mapper.c
index 853459e..ee4e8c5 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -496,7 +496,8 @@ input_info_get_output (GsdInputInfo *input)
        if (input->guessed_output)
                return input->guessed_output;
 
-       if (g_hash_table_size (input->mapper->output_devices) == 1) {
+       if (input->mapper->output_devices &&
+           g_hash_table_size (input->mapper->output_devices) == 1) {
                GsdOutputInfo *output;
                GHashTableIter iter;
 
@@ -878,7 +879,8 @@ input_info_new (GdkDevice   *device,
                                                     info);
 
                /* Assign output from config */
-               rr_output = settings_get_display (settings, mapper);
+               if (mapper->rr_screen)
+                       rr_output = settings_get_display (settings, mapper);
        }
 
        input_info_update_capabilities (info);


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