marlin r1289 - trunk/marlin



Author: iain
Date: Thu Oct  2 00:14:16 2008
New Revision: 1289
URL: http://svn.gnome.org/viewvc/marlin?rev=1289&view=rev

Log:
Split out the finalize function into a dispose as well


Modified:
   trunk/marlin/ChangeLog
   trunk/marlin/marlin-sample.c

Modified: trunk/marlin/marlin-sample.c
==============================================================================
--- trunk/marlin/marlin-sample.c	(original)
+++ trunk/marlin/marlin-sample.c	Thu Oct  2 00:14:16 2008
@@ -2,7 +2,7 @@
 /*
  *  Authors: Iain Holmes <iain gnome org>
  *
- *  Copyright 2002 - 2006 Iain Holmes
+ *  Copyright 2002 - 2008 Iain Holmes
  *
  *  This file is free software; you can redistribute it and/or
  *  modify it under the terms of version 2 of the GNU Library General Public
@@ -134,30 +134,16 @@
 	for (i = 0; i < priv->channel_data->len; i++) {
 		marlin_channel_free (priv->channel_data->pdata[i]);
 	}
-	
-	g_free (priv->filename);
-
-	g_object_unref (G_OBJECT (priv->selection));
-
-	if (priv->change_id > 0) {
-		g_signal_handler_disconnect (priv->markers, priv->change_id);
-	}
-	if (priv->add_id > 0) {
-		g_signal_handler_disconnect (priv->markers, priv->add_id);
-	}
-	if (priv->remove_id > 0) {
-		g_signal_handler_disconnect (priv->markers, priv->remove_id);
-	}
 
-	g_object_unref (G_OBJECT (priv->markers));
+	g_free (priv->filename);
 
 	if (priv->taglist != NULL) {
 		gst_structure_free (priv->taglist);
 	}
-	
+
 	WRITE_UNLOCK (priv->lock);
 	marlin_read_write_lock_destroy (priv->lock);
-	
+
 	g_free (priv);
 	sample->priv = NULL;
 
@@ -165,6 +151,38 @@
 }
 
 static void
+dispose (GObject *object)
+{
+	MarlinSample *sample = (MarlinSample *) sample;
+	MarlinSamplePrivate *priv = sample->priv;
+
+	if (priv->selection) {
+		g_object_unref (priv->selection);
+		priv->selection = NULL;
+	}
+
+	if (priv->markers) {
+		if (priv->change_id > 0) {
+			g_signal_handler_disconnect (priv->markers,
+						     priv->change_id);
+		}
+		if (priv->add_id > 0) {
+			g_signal_handler_disconnect (priv->markers,
+						     priv->add_id);
+		}
+		if (priv->remove_id > 0) {
+			g_signal_handler_disconnect (priv->markers,
+						     priv->remove_id);
+		}
+
+		g_object_unref (G_OBJECT (priv->markers));
+		priv->markers = NULL;
+	}
+
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
 marker_changed (MarlinMarkerModel *model,
 		MarlinMarker *marker,
 		MarlinSample *sample)
@@ -489,9 +507,10 @@
 class_init (GObjectClass *klass)
 {
 	klass->finalize = finalize;
+	klass->dispose = dispose;
 	klass->set_property = set_property;
 	klass->get_property = get_property;
-	
+
 	parent_class = g_type_class_peek_parent (klass);
 
 	/* Properties */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]