[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31999] trunk/blender/source/blender/ quicktime/apple/qtkit_import.m: Fix for [#23753]: Enable QTKit import to run in background thread

Damien Plisson damien.plisson at yahoo.fr
Sat Sep 18 14:50:46 CEST 2010


Revision: 31999
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31999
Author:   damien78
Date:     2010-09-18 14:50:45 +0200 (Sat, 18 Sep 2010)

Log Message:
-----------
Fix for [#23753]: Enable QTKit import to run in background thread
Was crashing file browser when there was some quicktime movies in the folder

Modified Paths:
--------------
    trunk/blender/source/blender/quicktime/apple/qtkit_import.m

Modified: trunk/blender/source/blender/quicktime/apple/qtkit_import.m
===================================================================
--- trunk/blender/source/blender/quicktime/apple/qtkit_import.m	2010-09-18 10:43:32 UTC (rev 31998)
+++ trunk/blender/source/blender/quicktime/apple/qtkit_import.m	2010-09-18 12:50:45 UTC (rev 31999)
@@ -30,6 +30,8 @@
  */
 #ifdef WITH_QUICKTIME
 
+#include "MEM_guardedalloc.h"
+
 #include "IMB_anim.h"
 #include "BLO_sys_types.h"
 #include "BKE_global.h"
@@ -113,6 +115,8 @@
 
 
 void free_anim_quicktime (struct anim *anim) {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
 	if (anim == NULL) return;
 	if (anim->qtime == NULL) return;
 
@@ -122,11 +126,15 @@
 	[anim->qtime->media release];
 	[anim->qtime->movie release];
 
+	[QTMovie exitQTKitOnThread];
+
 	if(anim->qtime) MEM_freeN (anim->qtime);
 
 	anim->qtime = NULL;
 
 	anim->duration = 0;
+
+	[pool drain];
 }
 
 static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
@@ -302,6 +310,8 @@
 
 	pool = [[NSAutoreleasePool alloc] init];
 	
+	[QTMovie enterQTKitOnThread];		
+
 	attributes = [NSDictionary dictionaryWithObjectsAndKeys:
 				  [NSString stringWithCString:anim->name 
 									 encoding:[NSString defaultCStringEncoding]], QTMovieFileNameAttribute,
@@ -314,6 +324,7 @@
 		if(QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
 		MEM_freeN(anim->qtime);
 		if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
+		[QTMovie exitQTKitOnThread];
 		[pool drain];
 		return -1;
 	}
@@ -328,6 +339,7 @@
 		[anim->qtime->movie release];
 		MEM_freeN(anim->qtime);
 		if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
+		[QTMovie exitQTKitOnThread];
 		[pool drain];
 		return -1;
 	}





More information about the Bf-blender-cvs mailing list