diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glibext/delayed.c | 67 |
1 files changed, 57 insertions, 10 deletions
diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c index e4dc37e..ae943d7 100644 --- a/src/glibext/delayed.c +++ b/src/glibext/delayed.c @@ -96,6 +96,12 @@ static void g_typed_queue_class_init(GTypedQueueClass *); /* Initialise une instance de gestionnaire de travaux typés. */ static void g_typed_queue_init(GTypedQueue *); +/* Supprime toutes les références externes. */ +static void g_typed_queue_dispose(GTypedQueue *); + +/* Procède à la libération totale de la mémoire. */ +static void g_typed_queue_finalize(GTypedQueue *); + /* Crée un nouveau thread dédié à un type de travaux donné. */ static GTypedQueue *g_typed_queue_new(GType, GtkExtStatusBar *); @@ -214,14 +220,10 @@ static void g_delayed_work_init(GDelayedWork *work) static void g_delayed_work_dispose(GDelayedWork *work) { - gpointer obj_class; /* Classe parente */ - g_mutex_free(work->mutex); g_cond_free(work->cond); - obj_class = g_type_class_peek_parent(G_DELAYED_WORK_GET_CLASS(work)); - - //G_OBJECT_CLASS(obj_class)->dispose(G_OBJECT(work)); + G_OBJECT_CLASS(g_delayed_work_parent_class)->dispose(G_OBJECT(work)); } @@ -240,11 +242,7 @@ static void g_delayed_work_dispose(GDelayedWork *work) static void g_delayed_work_finalize(GDelayedWork *work) { - gpointer obj_class; /* Classe parente */ - - obj_class = g_type_class_peek_parent(G_DELAYED_WORK_GET_CLASS(work)); - - //G_OBJECT_CLASS(obj_class)->finalize(G_OBJECT(work)); + G_OBJECT_CLASS(g_delayed_work_parent_class)->finalize(G_OBJECT(work)); } @@ -326,6 +324,12 @@ G_DEFINE_TYPE(GTypedQueue, g_typed_queue, G_TYPE_OBJECT); static void g_typed_queue_class_init(GTypedQueueClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_typed_queue_dispose; + object->finalize = (GObjectFinalizeFunc)g_typed_queue_finalize; } @@ -367,6 +371,47 @@ static void g_typed_queue_init(GTypedQueue *queue) /****************************************************************************** * * +* Paramètres : queue = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_typed_queue_dispose(GTypedQueue *queue) +{ + g_mutex_free(queue->mutex); + g_cond_free(queue->cond); + + G_OBJECT_CLASS(g_typed_queue_parent_class)->dispose(G_OBJECT(queue)); + +} + + +/****************************************************************************** +* * +* Paramètres : queue = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_typed_queue_finalize(GTypedQueue *queue) +{ + G_OBJECT_CLASS(g_typed_queue_parent_class)->finalize(G_OBJECT(queue)); + +} + + +/****************************************************************************** +* * * Paramètres : type = type dont seront marqués tous les travaux donnés.* * statusbar = barre de statut à tenir informée. * * * @@ -385,7 +430,9 @@ static GTypedQueue *g_typed_queue_new(GType type, GtkExtStatusBar *statusbar) result = g_object_new(G_TYPE_TYPED_QUEUE, NULL); result->type = type; + result->statusbar = statusbar; + g_object_ref(statusbar); return result; |