[clutter] device: Prevent segfault



commit c836b8c53c473e7d309c6c0c9d25b3ec74c827ff
Author: Peter Ward <peteraward gmail com>
Date:   Sat May 28 00:12:15 2011 +1000

    device: Prevent segfault
    
    When disposing a slave device without a master.
    
    http://bugzilla.clutter-project.org/show_bug.cgi?id=2655

 clutter/clutter-input-device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c
index 24f0b94..4bbdeb5 100644
--- a/clutter/clutter-input-device.c
+++ b/clutter/clutter-input-device.c
@@ -78,11 +78,11 @@ clutter_input_device_dispose (GObject *gobject)
 
   g_free (device->device_name);
 
-  if (device->device_mode == CLUTTER_INPUT_MODE_SLAVE)
-    _clutter_input_device_remove_slave (device->associated, device);
-
   if (device->associated != NULL)
     {
+      if (device->device_mode == CLUTTER_INPUT_MODE_SLAVE)
+        _clutter_input_device_remove_slave (device->associated, device);
+
       _clutter_input_device_set_associated_device (device->associated, NULL);
       g_object_unref (device->associated);
       device->associated = NULL;



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