mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
(iOS Thread) Fix crash when returning from background
This commit is contained in:
parent
c778844852
commit
67ced23555
@ -105,6 +105,18 @@ static UIView* g_pause_indicator_view;
|
||||
];
|
||||
}
|
||||
|
||||
- (void)suspend
|
||||
{
|
||||
g_view.context = nil;
|
||||
[EAGLContext setCurrentContext:nil];
|
||||
}
|
||||
|
||||
- (void)resume
|
||||
{
|
||||
g_view.context = g_context;
|
||||
[EAGLContext setCurrentContext:g_context];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
bool ios_init_game_view()
|
||||
@ -169,7 +181,8 @@ void ios_get_game_view_size(unsigned *width, unsigned *height)
|
||||
void ios_bind_game_view_fbo()
|
||||
{
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[g_view bindDrawable];
|
||||
if (g_context)
|
||||
[g_view display];
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -52,16 +52,6 @@ static void event_set_state_slot(void* userdata)
|
||||
g_extern.state_slot = (uint32_t)userdata;
|
||||
}
|
||||
|
||||
static void event_init_drivers(void* userdata)
|
||||
{
|
||||
init_drivers();
|
||||
}
|
||||
|
||||
static void event_uninit_drivers(void* userdata)
|
||||
{
|
||||
uninit_drivers();
|
||||
}
|
||||
|
||||
static void event_reload_config(void* userdata)
|
||||
{
|
||||
// Need to clear these otherwise stale versions may be used!
|
||||
@ -114,14 +104,12 @@ static void event_reload_config(void* userdata)
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||
{
|
||||
if (_isRunning)
|
||||
ios_frontend_post_event(&event_init_drivers, 0);
|
||||
[RAGameView.get resume];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||
{
|
||||
if (_isRunning)
|
||||
ios_frontend_post_event(&event_uninit_drivers, 0);
|
||||
[RAGameView.get suspend];
|
||||
}
|
||||
|
||||
// UINavigationControllerDelegate
|
||||
|
@ -22,6 +22,9 @@
|
||||
+ (RAGameView*)get;
|
||||
- (void)openPauseMenu;
|
||||
- (void)closePauseMenu;
|
||||
|
||||
- (void)suspend;
|
||||
- (void)resume;
|
||||
@end
|
||||
|
||||
@interface RALogView : UITableViewController
|
||||
|
Loading…
x
Reference in New Issue
Block a user