diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-10-15 08:31:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 12:04:20 +0100 |
commit | a8e14bee58ea3a7404eabc3687cb11ef778497a3 (patch) | |
tree | 11fe7e7ddbece4e43a8117c67d5045c2db6455e6 /platform/osx | |
parent | d10406a59aa6f1291fc19ceb8f302ad3f6640d1c (diff) | |
parent | a85923b972c442b737d7c48f0349b8a4187811e8 (diff) |
Merge pull request #32821 from bruvzg/vlk_fix_macos_exit
[Vulkan, macOS] Fix RID leaks and crashes on exit.
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/os_osx.mm | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 5fd663e51e..5757cd879d 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -282,6 +282,8 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { //_Godotwindow* window; } +- (void)windowWillClose:(NSNotification *)notification; + @end @implementation GodotWindowDelegate @@ -294,6 +296,24 @@ static NSCursor *cursorFromSelector(SEL selector, SEL fallback = nil) { return NO; } +- (void)windowWillClose:(NSNotification *)notification { +#if defined(VULKAN_ENABLED) + if (OS_OSX::singleton->video_driver_index == OS::VIDEO_DRIVER_VULKAN) { + + if (OS_OSX::singleton->rendering_device_vulkan) { + OS_OSX::singleton->rendering_device_vulkan->finalize(); + memdelete(OS_OSX::singleton->rendering_device_vulkan); + OS_OSX::singleton->rendering_device_vulkan = NULL; + } + + if (OS_OSX::singleton->context_vulkan) { + memdelete(OS_OSX::singleton->context_vulkan); + OS_OSX::singleton->context_vulkan = NULL; + } + } +#endif +} + - (void)windowDidEnterFullScreen:(NSNotification *)notification { OS_OSX::singleton->zoomed = true; @@ -1632,19 +1652,6 @@ void OS_OSX::finalize() { memdelete(context_gles2); } #endif -#if defined(VULKAN_ENABLED) - if (video_driver_index == VIDEO_DRIVER_VULKAN) { - - if (rendering_device_vulkan) { - rendering_device_vulkan->finalize(); - memdelete(rendering_device_vulkan); - } - - if (context_vulkan) - memdelete(context_vulkan); - - } -#endif CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL); CGDisplayRemoveReconfigurationCallback(displays_arrangement_changed, NULL); |