? autom4te.cache
? depcomp
? eog.desktop.in
? install-sh
? missing
? mkinstalldirs
? omf.make
? patch2.txt
? stamp-h1
? xmldocs.make
? libeog/test-eog-job
? libeog/test-image-load
? po/.intltool-merge-cache
? po/stamp-it
Index: libeog/eog-full-screen.c
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-full-screen.c,v
retrieving revision 1.34
diff -u -r1.34 eog-full-screen.c
--- libeog/eog-full-screen.c	2 Mar 2006 19:14:51 -0000	1.34
+++ libeog/eog-full-screen.c	7 May 2006 12:54:26 -0000
@@ -883,3 +883,44 @@
 
 	return image;
 }
+
+void
+eog_full_screen_prepare_destroy (EogFullScreen *fs)
+{
+	EogImage *image;
+	EogFullScreenPrivate *priv;
+	EogJob *job;
+	int job_id;
+
+	g_return_if_fail (EOG_IS_FULL_SCREEN (fs));
+
+	priv = fs->priv;
+
+	image = eog_image_list_get_img_by_iter (priv->list, priv->preload);
+	if (image != NULL) {
+		/* There is a job processing right now to preload
+		 * the next image to be displayed. we can't destroy
+		 * the object without letting that job to finish,
+		 * otherwise the finish callback will be called after
+		 * the object is deleted, and it will crash.
+		 * (in our case the finish callback is job_image_load_finished ())
+		 */ 
+		job_id = GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (image), JOB_ID_QUARK));
+		g_object_unref (image);
+
+		if (job_id > 0) {
+			job = eog_job_manager_get_job (job_id);
+			while (!eog_job_finish_callback_called (job))
+			{
+				/* waiting for the job finish callback to
+				 * complete. i run gtk_main_iteration,
+				 * because that callback is called in the GTK
+				 * idle loop.
+				 */
+				while (gtk_events_pending ())
+					gtk_main_iteration ();
+				g_usleep(1000000);
+			}
+		}
+	}
+}
Index: libeog/eog-full-screen.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-full-screen.h,v
retrieving revision 1.7
diff -u -r1.7 eog-full-screen.h
--- libeog/eog-full-screen.h	30 Oct 2005 02:52:22 -0000	1.7
+++ libeog/eog-full-screen.h	7 May 2006 12:54:26 -0000
@@ -65,6 +65,9 @@
 
 EogImage*  eog_full_screen_get_last_image (EogFullScreen *fs);
 
+/* you must call this function before destroying the object! */
+void eog_full_screen_prepare_destroy (EogFullScreen *fs);
+
 G_END_DECLS
 
 #endif /* _EOG_FULL_SCREEN_H_ */
Index: libeog/eog-job.c
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-job.c,v
retrieving revision 1.6
diff -u -r1.6 eog-job.c
--- libeog/eog-job.c	19 Feb 2006 03:21:22 -0000	1.6
+++ libeog/eog-job.c	7 May 2006 12:54:27 -0000
@@ -29,6 +29,7 @@
 	guint         progress_n_parts;
 	float         progress_threshold;
 	guint         priority;
+	gboolean      finished_callback_called;
 	
 	EogJobActionFunc af;
 	EogJobCancelFunc cf;
@@ -171,6 +172,7 @@
 	priv->progress_threshold = 0.1;
 	priv->progress_n_parts = 1;
 	priv->priority = EOG_JOB_PRIORITY_NORMAL;
+	priv->finished_callback_called = FALSE;
 
 	obj->priv = priv;
 }
@@ -439,6 +441,7 @@
 	if (call_finished) {
 		/* call finished callback */
 		(*job->priv->ff) (job, job->priv->data, job->priv->error);
+		job->priv->finished_callback_called = TRUE;
 	}
 }
 
@@ -448,4 +451,11 @@
 	g_return_val_if_fail (EOG_IS_JOB (job), EOG_JOB_PRIORITY_NORMAL);
 
 	return job->priv->priority;
+}
+
+gboolean
+eog_job_finish_callback_called (EogJob *job)
+{
+	g_return_if_fail (EOG_IS_JOB (job));
+	return job->priv->finished_callback_called;
 }
Index: libeog/eog-job.h
===================================================================
RCS file: /cvs/gnome/eog/libeog/eog-job.h,v
retrieving revision 1.2
diff -u -r1.2 eog-job.h
--- libeog/eog-job.h	14 Mar 2005 20:35:13 -0000	1.2
+++ libeog/eog-job.h	7 May 2006 12:54:27 -0000
@@ -67,6 +67,7 @@
 gboolean            eog_job_get_success  (EogJob *job);
 void                eog_job_set_progress (EogJob *job, float progress);
 EogJobPriority      eog_job_get_priority (EogJob *job);
+gboolean            eog_job_finish_callback_called (EogJob *job);
 
 /* API only used by the EogJobManager */
 void                eog_job_call_action   (EogJob *job);
Index: shell/eog-window.c
===================================================================
RCS file: /cvs/gnome/eog/shell/eog-window.c,v
retrieving revision 1.189
diff -u -r1.189 eog-window.c
--- shell/eog-window.c	27 Mar 2006 01:29:14 -0000	1.189
+++ shell/eog-window.c	7 May 2006 12:54:35 -0000
@@ -742,6 +742,7 @@
 		g_object_unref (last_image);
 	}
 
+	eog_full_screen_prepare_destroy (fs);
 	gtk_widget_destroy (widget);
 }
 
