Fixed a crash when destroying the actor of a LEAVE event

When processing a LEAVE event, one might destroy the actor, so the weak
reference device->actor would be NULL.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2502

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Johan Bilien 2010-12-29 16:49:13 -05:00 committed by Emmanuele Bassi
parent 2911d3db53
commit 601b958ab1

View File

@ -359,12 +359,16 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
*/ */
_clutter_process_event (&cev); _clutter_process_event (&cev);
_clutter_actor_set_has_pointer (device->cursor_actor, FALSE); /* processing the event might have destroyed the actor */
g_object_weak_unref (G_OBJECT (device->cursor_actor), if (device->cursor_actor != NULL)
cursor_weak_unref, {
device); _clutter_actor_set_has_pointer (device->cursor_actor, FALSE);
g_object_weak_unref (G_OBJECT (device->cursor_actor),
cursor_weak_unref,
device);
device->cursor_actor = NULL; device->cursor_actor = NULL;
}
} }
if (actor != NULL) if (actor != NULL)