Permalink
Browse files

Fixes infinite loops when call endProcess by adding a flag to check i…

…f the filter has already started the end process
  • Loading branch information...
1 parent 49fcf22 commit abe404b254039fe7a3708843e48cc0a423428496 @achambers16 achambers16 committed Nov 8, 2013
@@ -57,6 +57,7 @@ typedef struct GPUMatrix3x3 GPUMatrix3x3;
GLfloat backgroundColorRed, backgroundColorGreen, backgroundColorBlue, backgroundColorAlpha;
BOOL preparedToCaptureImage;
+ BOOL isEndProcessing;
// Texture caches are an iOS-specific capability
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
@@ -1002,9 +1002,14 @@ - (CGSize)maximumOutputSize;
- (void)endProcessing
{
- for (id<GPUImageInput> currentTarget in targets)
+ if (!isEndProcessing)
{
- [currentTarget endProcessing];
+ isEndProcessing = YES;
+
+ for (id<GPUImageInput> currentTarget in targets)
+ {
+ [currentTarget endProcessing];
+ }
}
}
@@ -4,6 +4,7 @@
@interface GPUImageFilterGroup : GPUImageOutput <GPUImageInput, GPUImageTextureDelegate>
{
NSMutableArray *filters;
+ BOOL isEndProcessing;
}
@property(readwrite, nonatomic, strong) GPUImageOutput<GPUImageInput> *terminalFilter;
@@ -182,9 +182,14 @@ - (CGSize)maximumOutputSize;
- (void)endProcessing;
{
- for (GPUImageOutput<GPUImageInput> *currentFilter in _initialFilters)
+ if (!isEndProcessing)
{
- [currentFilter endProcessing];
+ isEndProcessing = YES;
+
+ for (id<GPUImageInput> currentTarget in targets)
+ {
+ [currentTarget endProcessing];
+ }
}
}

0 comments on commit abe404b

Please sign in to comment.