[mistelix/stable] Stop glib timer on preview destroy



commit 48af734e8e2717994d73b02d748db201fdfec9ef
Author: Jordi Mas <jmas softcatala org>
Date:   Mon Jul 13 11:49:37 2009 +0200

    Stop glib timer on preview destroy

 src/widgets/SlideShowView.cs |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/widgets/SlideShowView.cs b/src/widgets/SlideShowView.cs
index 463dfe2..91993a8 100644
--- a/src/widgets/SlideShowView.cs
+++ b/src/widgets/SlideShowView.cs
@@ -93,6 +93,7 @@ namespace Mistelix.Widgets
 		bool paused = false;
 		const uint MinTime = 100;
 		bool started = false;
+		bool destroyed = false;
 
 		int CurrentIndex {
 			set {
@@ -159,6 +160,7 @@ namespace Mistelix.Widgets
 		
 		public override void Destroy()
 		{
+			destroyed = true;
 			ClearTransition();
 			if(current_image != null)
 				current_image.ReleasePixels();
@@ -247,9 +249,13 @@ namespace Mistelix.Widgets
 			}
 			return base.OnExposeEvent(args);
 		}
-		
+
+		// Return true to restart the timeout. Returning false clears the timeout
 		bool OnNextSlide()
 		{
+			if (destroyed)
+				return false;
+
 			if(paused)
 				return true;
 			else if(transition.MoveNext()) {



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