device: Prevent segfault

When disposing a slave device without a master.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2655
This commit is contained in:
Peter Ward 2011-05-28 00:12:15 +10:00 committed by Emmanuele Bassi
parent 0b0d4e1239
commit c836b8c53c

View File

@ -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;