From 65d1a65b49a3b85c6f77fd5cd09c23e1ea3cded0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 23 Mar 2007 23:57:24 +0000 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ clutter/clutter-backend.c | 25 +++++++++++++++++-------- clutter/glx/clutter-backend-glx.c | 1 + 3 files changed, 27 insertions(+), 8 deletions(-) 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;