[clutter] input-device: Do not use weak references with actors
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] input-device: Do not use weak references with actors
- Date: Mon, 13 Feb 2012 08:53:24 +0000 (UTC)
commit 8f6da170bc2e8fb9ca02970ca864add9f7722c5d
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Feb 13 08:52:08 2012 +0000
input-device: Do not use weak references with actors
Use the ClutterActor::destroy signal.
clutter/clutter-input-device.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/clutter/clutter-input-device.c b/clutter/clutter-input-device.c
index e9a4218..9743d05 100644
--- a/clutter/clutter-input-device.c
+++ b/clutter/clutter-input-device.c
@@ -422,16 +422,10 @@ _clutter_input_device_set_time (ClutterInputDevice *device,
device->current_time = time_;
}
-/* #ClutterInputDevice keeps a weak reference on the actor
- * under its pointer; this function unsets the reference on
- * the actor to avoid keeping around stale pointers
- */
static void
-cursor_weak_unref (gpointer user_data,
- GObject *object_pointer)
+on_cursor_actor_destroy (ClutterActor *actor,
+ ClutterInputDevice *device)
{
- ClutterInputDevice *device = user_data;
-
device->cursor_actor = NULL;
}
@@ -533,9 +527,9 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
if (device->cursor_actor != NULL)
{
_clutter_actor_set_has_pointer (device->cursor_actor, FALSE);
- g_object_weak_unref (G_OBJECT (device->cursor_actor),
- cursor_weak_unref,
- device);
+ g_signal_handlers_disconnect_by_func (device->cursor_actor,
+ G_CALLBACK (on_cursor_actor_destroy),
+ device);
device->cursor_actor = NULL;
}
@@ -567,9 +561,9 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
device->cursor_actor = actor;
if (device->cursor_actor != NULL)
{
- g_object_weak_ref (G_OBJECT (device->cursor_actor),
- cursor_weak_unref,
- device);
+ g_signal_connect (device->cursor_actor,
+ "destroy", G_CALLBACK (on_cursor_actor_destroy),
+ device);
_clutter_actor_set_has_pointer (device->cursor_actor, TRUE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]