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,6 +359,9 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
*/ */
_clutter_process_event (&cev); _clutter_process_event (&cev);
/* processing the event might have destroyed the actor */
if (device->cursor_actor != NULL)
{
_clutter_actor_set_has_pointer (device->cursor_actor, FALSE); _clutter_actor_set_has_pointer (device->cursor_actor, FALSE);
g_object_weak_unref (G_OBJECT (device->cursor_actor), g_object_weak_unref (G_OBJECT (device->cursor_actor),
cursor_weak_unref, cursor_weak_unref,
@ -366,6 +369,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
device->cursor_actor = NULL; device->cursor_actor = NULL;
} }
}
if (actor != NULL) if (actor != NULL)
{ {