From 6aa396936e0300bf09998e87c89e8339fd4cdcec Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 20 Jun 2011 20:20:43 +0000 Subject: [PATCH] fixed cvDestroyWindow(), cvDestroyAllWindows() and cvSetTrackbarPos() on mac (ticket #631) --- modules/highgui/src/window_cocoa.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/highgui/src/window_cocoa.mm b/modules/highgui/src/window_cocoa.mm index 0abc07c537..f141e22354 100644 --- a/modules/highgui/src/window_cocoa.mm +++ b/modules/highgui/src/window_cocoa.mm @@ -183,7 +183,7 @@ CV_IMPL void cvDestroyWindow( const char* name) //cout << "cvDestroyWindow" << endl; CVWindow *window = cvGetWindow(name); if(window) { - [window performClose:nil]; + [window close]; [windows removeObjectForKey:[NSString stringWithFormat:@"%s", name]]; } [localpool drain]; @@ -194,10 +194,10 @@ CV_IMPL void cvDestroyAllWindows( void ) { //cout << "cvDestroyAllWindows" << endl; NSAutoreleasePool* localpool = [[NSAutoreleasePool alloc] init]; - for(NSString *key in windows) { - [[windows valueForKey:key] performClose:nil]; - } - [windows removeAllObjects]; + NSDictionary* list = [NSDictionary dictionaryWithDictionary:windows]; + for(NSString *key in list) { + cvDestroyWindow([key cStringUsingEncoding:NSASCIIStringEncoding]); + } [localpool drain]; } @@ -402,7 +402,7 @@ CV_IMPL void cvSetTrackbarPos(const char* trackbar_name, const char* window_name if(trackbar_name == NULL || window_name == NULL) CV_ERROR( CV_StsNullPtr, "NULL trackbar or window name" ); - if(pos <= 0) + if(pos < 0) CV_ERROR( CV_StsOutOfRange, "Bad trackbar maximal value" ); if (localpool5 != nil) [localpool5 drain];