Commit c937e991 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

winemac.drv: Use @autoreleasepool instead of NSAutoreleasePool.

parent 3582ba9d
......@@ -333,14 +333,15 @@ static NSString* WineLocalizedString(unsigned int stringID)
{
if (processEvents)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:timeout
inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event)
[NSApp sendEvent:event];
[pool release];
@autoreleasepool
{
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:timeout
inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event)
[NSApp sendEvent:event];
}
}
else
[[NSRunLoop currentRunLoop] runMode:WineAppWaitQueryResponseMode beforeDate:timeout];
......@@ -2281,34 +2282,34 @@ static NSString* WineLocalizedString(unsigned int stringID)
*/
static void PerformRequest(void *info)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineApplicationController* controller = [WineApplicationController sharedController];
for (;;)
{
__block dispatch_block_t block;
dispatch_sync(controller->requestsManipQueue, ^{
if ([controller->requests count])
{
block = (dispatch_block_t)[[controller->requests objectAtIndex:0] retain];
[controller->requests removeObjectAtIndex:0];
}
else
block = nil;
});
@autoreleasepool
{
__block dispatch_block_t block;
if (!block)
break;
dispatch_sync(controller->requestsManipQueue, ^{
if ([controller->requests count])
{
block = (dispatch_block_t)[[controller->requests objectAtIndex:0] retain];
[controller->requests removeObjectAtIndex:0];
}
else
block = nil;
});
block();
[block release];
if (!block)
break;
[pool release];
pool = [[NSAutoreleasePool alloc] init];
block();
[block release];
}
}
[pool release];
}
}
/***********************************************************************
......@@ -2347,13 +2348,12 @@ void LogError(const char* func, NSString* format, ...)
*/
void LogErrorv(const char* func, NSString* format, va_list args)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
NSString* message = [[NSString alloc] initWithFormat:format arguments:args];
fprintf(stderr, "err:%s:%s", func, [message UTF8String]);
[message release];
[pool release];
}
}
/***********************************************************************
......
......@@ -88,9 +88,10 @@ int macdrv_has_pasteboard_changed(void)
*/
CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard)
{
@autoreleasepool
{
NSPasteboard* pb = (NSPasteboard*)pasteboard;
__block CFArrayRef ret = NULL;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
dispatch_once(&BitmapOutputTypesInitOnce, ^{
NSArray* bitmapFileTypes = [NSArray arrayWithObjects:
......@@ -138,9 +139,9 @@ CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard)
}
});
[pool release];
return ret;
}
}
/***********************************************************************
......
......@@ -58,8 +58,9 @@ static inline void convert_display_rect(CGRect* out_rect, NSRect in_rect,
*/
int macdrv_get_displays(struct macdrv_display** displays, int* count)
{
@autoreleasepool
{
int ret = -1;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSArray* screens = [NSScreen screens];
if (screens)
......@@ -95,9 +96,9 @@ int macdrv_get_displays(struct macdrv_display** displays, int* count)
}
}
[pool release];
return ret;
}
}
/***********************************************************************
......@@ -191,11 +192,12 @@ done:
*/
static int macdrv_get_gpu_info_from_entry(struct macdrv_gpu* gpu, io_registry_entry_t entry)
{
@autoreleasepool
{
io_registry_entry_t parent_entry;
io_registry_entry_t gpu_entry;
kern_return_t result;
int ret = -1;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
gpu_entry = entry;
while (![@"IOPCIDevice" isEqualToString:[(NSString*)IOObjectCopyClass(gpu_entry) autorelease]])
......@@ -211,7 +213,6 @@ static int macdrv_get_gpu_info_from_entry(struct macdrv_gpu* gpu, io_registry_en
}
else if (result != kIOReturnSuccess)
{
[pool release];
return ret;
}
......@@ -232,9 +233,9 @@ static int macdrv_get_gpu_info_from_entry(struct macdrv_gpu* gpu, io_registry_en
done:
if (gpu_entry != entry)
IOObjectRelease(gpu_entry);
[pool release];
return ret;
}
}
#ifdef HAVE_MTLDEVICE_REGISTRYID
......@@ -298,6 +299,8 @@ static int macdrv_get_gpu_info_from_mtldevice(struct macdrv_gpu* gpu, id<MTLDevi
*/
static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
{
@autoreleasepool
{
struct macdrv_gpu* gpus = NULL;
struct macdrv_gpu primary_gpu;
id<MTLDevice> primary_device;
......@@ -305,7 +308,6 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
int primary_index = 0, i;
int gpu_count = 0;
int ret = -1;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
/* Test if Metal is available */
if (&MTLCopyAllDevices == NULL)
......@@ -364,9 +366,9 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
done:
if (ret)
macdrv_free_gpus(gpus);
[pool release];
return ret;
}
}
/***********************************************************************
* macdrv_get_gpu_info_from_display_id_using_metal
......@@ -377,9 +379,10 @@ done:
*/
static int macdrv_get_gpu_info_from_display_id_using_metal(struct macdrv_gpu* gpu, CGDirectDisplayID display_id)
{
@autoreleasepool
{
id<MTLDevice> device;
int ret = -1;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
/* Test if Metal is available */
if (&CGDirectDisplayCopyCurrentMetalDevice == NULL)
......@@ -390,9 +393,9 @@ static int macdrv_get_gpu_info_from_display_id_using_metal(struct macdrv_gpu* gp
ret = macdrv_get_gpu_info_from_registry_id(gpu, device.registryID);
done:
[pool release];
return ret;
}
}
#else
......
......@@ -292,7 +292,8 @@ static const OSType WineHotKeySignature = 'Wine';
- (void) discardEventsPassingTest:(BOOL (^)(macdrv_event* event))block
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
NSIndexSet* indexes;
[eventsLock lock];
......@@ -305,8 +306,7 @@ static const OSType WineHotKeySignature = 'Wine';
[events removeObjectsAtIndexes:indexes];
[eventsLock unlock];
[pool release];
}
}
- (void) discardEventsMatchingMask:(macdrv_event_mask)mask forWindow:(NSWindow*)window
......@@ -494,7 +494,8 @@ static const OSType WineHotKeySignature = 'Wine';
*/
void OnMainThread(dispatch_block_t block)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
NSMutableDictionary* threadDict = [[NSThread currentThread] threadDictionary];
WineEventQueue* queue = [threadDict objectForKey:WineEventQueueThreadDictionaryKey];
dispatch_semaphore_t semaphore = NULL;
......@@ -523,21 +524,19 @@ void OnMainThread(dispatch_block_t block)
{
while (!finished)
{
MacDrvEvent* macDrvEvent;
struct kevent kev;
while (!finished &&
(macDrvEvent = [queue getEventMatchingMask:event_mask_for_type(QUERY_EVENT)]))
@autoreleasepool
{
queue->event_handler(macDrvEvent->event);
}
MacDrvEvent* macDrvEvent;
struct kevent kev;
if (!finished)
{
[pool release];
pool = [[NSAutoreleasePool alloc] init];
while (!finished &&
(macDrvEvent = [queue getEventMatchingMask:event_mask_for_type(QUERY_EVENT)]))
{
queue->event_handler(macDrvEvent->event);
}
kevent(queue->kq, NULL, 0, &kev, 1, NULL);
if (!finished)
kevent(queue->kq, NULL, 0, &kev, 1, NULL);
}
}
}
......@@ -546,8 +545,7 @@ void OnMainThread(dispatch_block_t block)
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_release(semaphore);
}
[pool release];
}
}
......@@ -559,7 +557,8 @@ void OnMainThread(dispatch_block_t block)
*/
macdrv_event_queue macdrv_create_event_queue(macdrv_event_handler handler)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
NSMutableDictionary* threadDict = [[NSThread currentThread] threadDictionary];
WineEventQueue* queue = [threadDict objectForKey:WineEventQueueThreadDictionaryKey];
......@@ -575,9 +574,9 @@ macdrv_event_queue macdrv_create_event_queue(macdrv_event_handler handler)
}
}
[pool release];
return (macdrv_event_queue)queue;
}
}
/***********************************************************************
* macdrv_destroy_event_queue
......@@ -587,14 +586,14 @@ macdrv_event_queue macdrv_create_event_queue(macdrv_event_handler handler)
*/
void macdrv_destroy_event_queue(macdrv_event_queue queue)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineEventQueue* q = (WineEventQueue*)queue;
NSMutableDictionary* threadDict = [[NSThread currentThread] threadDictionary];
[[WineApplicationController sharedController] unregisterEventQueue:q];
[threadDict removeObjectForKey:WineEventQueueThreadDictionaryKey];
[pool release];
}
}
/***********************************************************************
......@@ -622,16 +621,17 @@ int macdrv_get_event_queue_fd(macdrv_event_queue queue)
int macdrv_copy_event_from_queue(macdrv_event_queue queue,
macdrv_event_mask mask, macdrv_event **event)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineEventQueue* q = (WineEventQueue*)queue;
MacDrvEvent* macDrvEvent = [q getEventMatchingMask:mask];
if (macDrvEvent)
*event = macdrv_retain_event(macDrvEvent->event);
[pool release];
return (macDrvEvent != nil);
}
}
/***********************************************************************
* macdrv_create_event
......@@ -666,10 +666,10 @@ macdrv_event* macdrv_retain_event(macdrv_event *event)
*/
void macdrv_release_event(macdrv_event *event)
{
@autoreleasepool
{
if (OSAtomicDecrement32Barrier(&event->refs) <= 0)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
switch (event->type)
{
case IM_SET_TEXT:
......@@ -691,10 +691,9 @@ void macdrv_release_event(macdrv_event *event)
[(WineWindow*)event->window release];
free(event);
[pool release];
}
}
}
/***********************************************************************
* macdrv_create_query
......
......@@ -64,35 +64,37 @@ static void run_cocoa_app(void* info)
NSConditionLock* lock = startup_info->lock;
BOOL created_app = FALSE;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (!NSApp)
{
[WineApplication sharedApplication];
created_app = TRUE;
}
if ([NSApp respondsToSelector:@selector(setWineController:)])
@autoreleasepool
{
WineApplicationController* controller = [WineApplicationController sharedController];
[NSApp setWineController:controller];
[controller computeEventTimeAdjustmentFromTicks:startup_info->tickcount uptime:startup_info->uptime_ns];
startup_info->success = TRUE;
}
if (!NSApp)
{
[WineApplication sharedApplication];
created_app = TRUE;
}
/* Retain the lock while we're using it, so macdrv_start_cocoa_app()
doesn't deallocate it in the middle of us unlocking it. */
[lock retain];
[lock lock];
[lock unlockWithCondition:COCOA_APP_RUNNING];
[lock release];
if ([NSApp respondsToSelector:@selector(setWineController:)])
{
WineApplicationController* controller = [WineApplicationController sharedController];
[NSApp setWineController:controller];
[controller computeEventTimeAdjustmentFromTicks:startup_info->tickcount uptime:startup_info->uptime_ns];
startup_info->success = TRUE;
}
[pool release];
/* Retain the lock while we're using it, so macdrv_start_cocoa_app()
doesn't deallocate it in the middle of us unlocking it. */
[lock retain];
[lock lock];
[lock unlockWithCondition:COCOA_APP_RUNNING];
[lock release];
}
if (created_app && startup_info->success)
{
/* Never returns */
[NSApp run];
@autoreleasepool
{
/* Never returns */
[NSApp run];
}
}
}
......@@ -106,6 +108,8 @@ static void run_cocoa_app(void* info)
*/
int macdrv_start_cocoa_app(unsigned long long tickcount)
{
@autoreleasepool
{
int ret = -1;
CFRunLoopSourceRef source;
struct cocoa_app_startup_info startup_info;
......@@ -114,8 +118,6 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
NSDate* timeLimit;
CFRunLoopSourceContext source_context = { 0 };
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/* Make sure Cocoa is in multi-threading mode by detaching a
do-nothing thread. */
[NSThread detachNewThreadSelector:@selector(self)
......@@ -151,6 +153,6 @@ int macdrv_start_cocoa_app(unsigned long long tickcount)
if (source)
CFRelease(source);
[startup_info.lock release];
[pool release];
return ret;
}
}
......@@ -242,14 +242,15 @@
*/
macdrv_opengl_context macdrv_create_opengl_context(void* cglctx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineOpenGLContext *context;
context = [[WineOpenGLContext alloc] initWithCGLContextObj:cglctx];
[pool release];
return (macdrv_opengl_context)context;
}
}
/***********************************************************************
* macdrv_dispose_opengl_context
......@@ -259,13 +260,13 @@ macdrv_opengl_context macdrv_create_opengl_context(void* cglctx)
*/
void macdrv_dispose_opengl_context(macdrv_opengl_context c)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineOpenGLContext *context = (WineOpenGLContext*)c;
[context removeFromViews:YES];
[context release];
[pool release];
}
}
/***********************************************************************
......@@ -273,7 +274,8 @@ void macdrv_dispose_opengl_context(macdrv_opengl_context c)
*/
void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v, CGRect r)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineOpenGLContext *context = (WineOpenGLContext*)c;
NSView* view = (NSView*)v;
......@@ -328,8 +330,7 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v, CGRect
if (context)
[context removeFromViews:YES];
}
[pool release];
}
}
/***********************************************************************
......@@ -337,7 +338,8 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v, CGRect
*/
void macdrv_update_opengl_context(macdrv_opengl_context c)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineOpenGLContext *context = (WineOpenGLContext*)c;
if (context.needsUpdate)
......@@ -367,8 +369,7 @@ void macdrv_update_opengl_context(macdrv_opengl_context c)
[context resetSurfaceIfBackingSizeChanged];
}
}
[pool release];
}
}
/***********************************************************************
......@@ -379,11 +380,11 @@ void macdrv_update_opengl_context(macdrv_opengl_context c)
*/
void macdrv_flush_opengl_context(macdrv_opengl_context c)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineOpenGLContext *context = (WineOpenGLContext*)c;
macdrv_update_opengl_context(c);
[context flushBuffer];
[pool release];
}
}
......@@ -3282,7 +3282,8 @@ macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf
*/
void macdrv_destroy_cocoa_window(macdrv_window w)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
......@@ -3292,8 +3293,7 @@ void macdrv_destroy_cocoa_window(macdrv_window w)
});
[window.queue discardEventsMatchingMask:-1 forWindow:window];
[window release];
[pool release];
}
}
/***********************************************************************
......@@ -3345,7 +3345,8 @@ void macdrv_set_cocoa_window_state(macdrv_window w,
void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title,
size_t length)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
NSString* titleString;
......@@ -3358,8 +3359,7 @@ void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title,
if ([window isOrderedIn] && ![window isExcludedFromWindowsMenu])
[NSApp changeWindowsItem:window title:titleString filename:NO];
});
[pool release];
}
}
/***********************************************************************
......@@ -3454,15 +3454,15 @@ void macdrv_set_cocoa_parent_window(macdrv_window w, macdrv_window parent)
*/
void macdrv_set_window_surface(macdrv_window w, void *surface, pthread_mutex_t *mutex)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
window.surface = surface;
window.surface_mutex = mutex;
});
[pool release];
}
}
/***********************************************************************
......@@ -3473,14 +3473,14 @@ void macdrv_set_window_surface(macdrv_window w, void *surface, pthread_mutex_t *
*/
void macdrv_window_needs_display(macdrv_window w, CGRect rect)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThreadAsync(^{
[[window contentView] setNeedsDisplayInRect:NSRectFromCGRect(cgrect_mac_from_win(rect))];
});
[pool release];
}
}
/***********************************************************************
......@@ -3491,7 +3491,8 @@ void macdrv_window_needs_display(macdrv_window w, CGRect rect)
*/
void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
......@@ -3512,8 +3513,7 @@ void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count)
CGPathRelease(path);
}
});
[pool release];
}
}
/***********************************************************************
......@@ -3521,12 +3521,12 @@ void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count)
*/
void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
[window setAlphaValue:alpha];
[pool release];
}
}
/***********************************************************************
......@@ -3535,7 +3535,8 @@ void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha)
void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGreen,
CGFloat keyBlue)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
......@@ -3545,8 +3546,7 @@ void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGre
window.colorKeyBlue = keyBlue;
[window checkTransparency];
});
[pool release];
}
}
/***********************************************************************
......@@ -3554,15 +3554,15 @@ void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat keyGre
*/
void macdrv_clear_window_color_key(macdrv_window w)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
window.colorKeyed = FALSE;
[window checkTransparency];
});
[pool release];
}
}
/***********************************************************************
......@@ -3570,15 +3570,15 @@ void macdrv_clear_window_color_key(macdrv_window w)
*/
void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineWindow* window = (WineWindow*)w;
OnMainThread(^{
window.usePerPixelAlpha = use_per_pixel_alpha;
[window checkTransparency];
});
[pool release];
}
}
/***********************************************************************
......@@ -3620,7 +3620,8 @@ void macdrv_set_window_min_max_sizes(macdrv_window w, CGSize min_size, CGSize ma
*/
macdrv_view macdrv_create_view(CGRect rect)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
__block WineContentView* view;
if (CGRectIsNull(rect)) rect = CGRectZero;
......@@ -3642,9 +3643,9 @@ macdrv_view macdrv_create_view(CGRect rect)
object:NSApp];
});
[pool release];
return (macdrv_view)view;
}
}
/***********************************************************************
* macdrv_dispose_view
......@@ -3653,7 +3654,8 @@ macdrv_view macdrv_create_view(CGRect rect)
*/
void macdrv_dispose_view(macdrv_view v)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
OnMainThread(^{
......@@ -3670,8 +3672,7 @@ void macdrv_dispose_view(macdrv_view v)
[view release];
[window updateForGLSubviews];
});
[pool release];
}
}
/***********************************************************************
......@@ -3679,7 +3680,8 @@ void macdrv_dispose_view(macdrv_view v)
*/
void macdrv_set_view_frame(macdrv_view v, CGRect rect)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
if (CGRectIsNull(rect)) rect = CGRectZero;
......@@ -3707,8 +3709,7 @@ void macdrv_set_view_frame(macdrv_view v, CGRect rect)
[(WineWindow*)[view window] updateForGLSubviews];
}
});
[pool release];
}
}
/***********************************************************************
......@@ -3721,7 +3722,8 @@ void macdrv_set_view_frame(macdrv_view v, CGRect rect)
*/
void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, macdrv_view p, macdrv_view n)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
WineContentView* superview = (WineContentView*)s;
WineWindow* window = (WineWindow*)w;
......@@ -3762,8 +3764,7 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
[newWindow updateForGLSubviews];
}
});
[pool release];
}
}
/***********************************************************************
......@@ -3771,15 +3772,15 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
*/
void macdrv_set_view_hidden(macdrv_view v, int hidden)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
OnMainThreadAsync(^{
[view setHidden:hidden];
[(WineWindow*)view.window updateForGLSubviews];
});
[pool release];
}
}
/***********************************************************************
......@@ -3789,15 +3790,15 @@ void macdrv_set_view_hidden(macdrv_view v, int hidden)
*/
void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
WineOpenGLContext *context = (WineOpenGLContext*)c;
OnMainThread(^{
[view addGLContext:context];
});
[pool release];
}
}
/***********************************************************************
......@@ -3807,19 +3808,21 @@ void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c)
*/
void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
WineContentView* view = (WineContentView*)v;
WineOpenGLContext *context = (WineOpenGLContext*)c;
OnMainThreadAsync(^{
[view removeGLContext:context];
});
[pool release];
}
}
macdrv_metal_device macdrv_create_metal_device(void)
{
@autoreleasepool
{
macdrv_metal_device ret;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11
......@@ -3827,17 +3830,17 @@ macdrv_metal_device macdrv_create_metal_device(void)
return NULL;
#endif
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
ret = (macdrv_metal_device)MTLCreateSystemDefaultDevice();
[pool release];
return ret;
}
}
void macdrv_release_metal_device(macdrv_metal_device d)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@autoreleasepool
{
[(id<MTLDevice>)d release];
[pool release];
}
}
macdrv_metal_view macdrv_view_create_metal_view(macdrv_view v, macdrv_metal_device d)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment