gnome-scan r519 - in trunk: . lib



Author: bersace
Date: Tue Feb 26 22:39:45 2008
New Revision: 519
URL: http://svn.gnome.org/viewvc/gnome-scan?rev=519&view=rev

Log:
Fix some ref/unref problems.


Modified:
   trunk/ChangeLog
   trunk/lib/gnome-scan-job.c

Modified: trunk/lib/gnome-scan-job.c
==============================================================================
--- trunk/lib/gnome-scan-job.c	(original)
+++ trunk/lib/gnome-scan-job.c	Tue Feb 26 22:39:45 2008
@@ -47,6 +47,7 @@
 
 struct _GnomeScanJobPrivate
 {
+	gboolean			disposed;
 	GnomeScanSettings	*settings;
 	GnomeScanner		*scanner;
 	GSList				*processors;
@@ -84,12 +85,17 @@
 }
 
 static void
-gnome_scan_job_finalize (GObject *object)
+gnome_scan_job_dispose (GObject *object)
 {
 	GnomeScanJobPrivate *priv = GET_PRIVATE(object);
-	g_object_unref(priv->settings);
-	g_object_unref(priv->sink);
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	
+	if (!priv->disposed) { 
+		g_object_unref(priv->settings);
+		g_object_unref(priv->sink);
+		priv->disposed = TRUE;
+	}
+	
+	G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 static void
@@ -150,7 +156,7 @@
 
 	g_type_class_add_private (klass, sizeof (GnomeScanJobPrivate));
 	
-	object_class->finalize = gnome_scan_job_finalize;
+	object_class->dispose = gnome_scan_job_dispose;
 	object_class->set_property = gnome_scan_job_set_property;
 	object_class->get_property = gnome_scan_job_get_property;
 
@@ -215,6 +221,8 @@
 	if (settings == NULL) {
 		settings = gnome_scan_settings_new();
 	}
+	else 
+		g_object_ref(settings);
 
 	GObject *object = g_object_new (GNOME_TYPE_SCAN_JOB,
 									"settings", settings,



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