[mutter] MetaMonitorConfig: don't keep a previous config with the wrong outputs



commit 01cd4b2ba02a729dcbcc06afa3aec315bc70ef2f
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue May 6 19:51:13 2014 +0200

    MetaMonitorConfig: don't keep a previous config with the wrong outputs
    
    We can only apply a configuration if its outputs match the connected
    ones, so discard the current configuration if the set of output changes
    (for example for hotplug), otherwise we will crash trying to apply
    the bogus previous configuration.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725637

 src/backends/meta-monitor-config.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index a232ff4..41fe60d 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -877,7 +877,8 @@ apply_configuration (MetaMonitorConfig  *self,
 
   /* Stored (persistent) configurations override the previous one always.
      Also, we clear the previous configuration if the current one (which is
-     about to become previous) is stored.
+     about to become previous) is stored, or if the current one has
+     different outputs.
   */
   if (stored ||
       (self->current && self->current_is_stored))
@@ -888,7 +889,19 @@ apply_configuration (MetaMonitorConfig  *self,
     }
   else
     {
-      self->previous = self->current;
+      /* Despite the name, config_equal() only checks the set of outputs,
+         not their modes
+      */
+      if (self->current && config_equal (self->current, config))
+        {
+          self->previous = self->current;
+        }
+      else
+        {
+          if (self->current)
+            config_free (self->current);
+          self->previous = NULL;
+        }
     }
 
   self->current = config;


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