diff options
author | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2018-01-03 18:26:44 +0100 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-04 15:15:55 +0100 |
commit | e315c94900be47e61152a2958011e14b7e635a3e (patch) | |
tree | 9fbe974664cd253d3fdd0792db0b7b5f91cfcde6 /platform/osx | |
parent | 99eb394a5f5f164a562e315980cb730a704a0a1c (diff) |
Change OS::initialize signature to return Error (fix segfault on x11)
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/os_osx.h | 2 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 0411b4e72b..2a71de12e9 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -123,7 +123,7 @@ protected: virtual const char *get_video_driver_name(int p_driver) const; virtual void initialize_core(); - virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); + virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); virtual void finalize(); virtual void set_main_loop(MainLoop *p_main_loop); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index dbc9cdf3b7..a16391c30f 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -976,7 +976,7 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay displays_arrangement_dirty = true; } -void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { +Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { /*** OSX INITIALIZATION ***/ /*** OSX INITIALIZATION ***/ @@ -1013,7 +1013,7 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au backing:NSBackingStoreBuffered defer:NO]; - ERR_FAIL_COND(window_object == nil); + ERR_FAIL_COND(window_object == nil, ERR_UNAVAILABLE); window_view = [[GodotContentView alloc] init]; @@ -1100,11 +1100,11 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au #undef ADD_ATTR2 pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - ERR_FAIL_COND(pixelFormat == nil); + ERR_FAIL_COND(pixelFormat == nil, ERR_UNAVAILABLE); context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; - ERR_FAIL_COND(context == nil); + ERR_FAIL_COND(context == nil, ERR_UNAVAILABLE); [context setView:window_view]; @@ -1148,6 +1148,8 @@ void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_au _ensure_user_data_dir(); restore_rect = Rect2(get_window_position(), get_window_size()); + + return OK; } void OS_OSX::finalize() { |