Skip to content

Commit dbb330d

Browse files
committed
Cocoa/highgui: fix leak in cvGetWindowRect_COCOA
1 parent 1d41108 commit dbb330d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

modules/highgui/src/window_cocoa.mm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,16 @@ CvRect cvGetWindowRect_COCOA( const char* name )
662662
{
663663
CV_ERROR( CV_StsNullPtr, "NULL window" );
664664
} else {
665-
NSRect rect = [window frame];
665+
@autoreleasepool {
666+
NSRect rect = [window frame];
666667
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
667-
NSPoint pt = [window convertRectToScreen:rect].origin;
668+
NSPoint pt = [window convertRectToScreen:rect].origin;
668669
#else
669-
NSPoint pt = [window convertBaseToScreen:rect.origin];
670+
NSPoint pt = [window convertBaseToScreen:rect.origin];
670671
#endif
671-
NSSize sz = [[[window contentView] image] size];
672-
result = cvRect(pt.x, pt.y, sz.width, sz.height);
672+
NSSize sz = [[[window contentView] image] size];
673+
result = cvRect(pt.x, pt.y, sz.width, sz.height);
674+
}
673675
}
674676

675677
__END__;

0 commit comments

Comments
 (0)