diff --git a/ChangeLog b/ChangeLog index a86bf8d7e..6d5a03081 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-03-23 Emmanuele Bassi + + * clutter/clutter-backend.c: Clear the event queue when + disposing the backend object; remove the initialisation + of the backend structure members... + + * clutter/glx/clutter-backend-glx.c: ... and keep it here + in the backends where it belongs. + 2007-03-23 Emmanuele Bassi * clutter/clutter-private.h: diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index 163bdae13..55fa711fe 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -34,24 +34,33 @@ G_DEFINE_ABSTRACT_TYPE (ClutterBackend, clutter_backend, G_TYPE_OBJECT); +static void +clutter_backend_dispose (GObject *gobject) +{ + ClutterBackend *backend = CLUTTER_BACKEND (gobject); + + if (backend->events_queue) + { + g_queue_foreach (backend->events_queue, (GFunc) clutter_event_free, NULL); + g_queue_free (backend->events_queue); + backend->events_queue = NULL; + } + + G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject); +} + static void clutter_backend_class_init (ClutterBackendClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + gobject_class->dispose = clutter_backend_dispose; } static void clutter_backend_init (ClutterBackend *backend) { - backend->events_queue = g_queue_new (); - backend->button_click_time[0] = backend->button_click_time[1] = 0; - backend->button_number[0] = backend->button_number[1] = -1; - backend->button_x[0] = backend->button_x[1] = 0; - backend->button_y[0] = backend->button_y[1] = 0; - - backend->double_click_time = 250; - backend->double_click_distance = 5; } ClutterActor * diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c index 6943987bf..d5cc04d28 100644 --- a/clutter/glx/clutter-backend-glx.c +++ b/clutter/glx/clutter-backend-glx.c @@ -314,6 +314,7 @@ static void clutter_backend_glx_init (ClutterBackendGlx *backend_glx) { ClutterBackend *backend = CLUTTER_BACKEND (backend_glx); + backend->events_queue = g_queue_new (); backend->button_click_time[0] = backend->button_click_time[1] = 0; backend->button_number[0] = backend->button_number[1] = -1;