Merge pull request #26625 from NekoAsakura:4.x

Cocoa/highgui: fix leak in cvGetWindowRect_COCOA
This commit is contained in:
Alexander Smorkalov 2024-12-20 09:03:33 +03:00 committed by GitHub
commit f3d9d56ebe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -662,14 +662,16 @@ CvRect cvGetWindowRect_COCOA( const char* name )
{
CV_ERROR( CV_StsNullPtr, "NULL window" );
} else {
NSRect rect = [window frame];
@autoreleasepool {
NSRect rect = [window frame];
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6
NSPoint pt = [window convertRectToScreen:rect].origin;
NSPoint pt = [window convertRectToScreen:rect].origin;
#else
NSPoint pt = [window convertBaseToScreen:rect.origin];
NSPoint pt = [window convertBaseToScreen:rect.origin];
#endif
NSSize sz = [[[window contentView] image] size];
result = cvRect(pt.x, pt.y, sz.width, sz.height);
NSSize sz = [[[window contentView] image] size];
result = cvRect(pt.x, pt.y, sz.width, sz.height);
}
}
__END__;