mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-12-11 20:43:39 +00:00
Fixed crash when pumping events after the window has been destroyed on Android
This commit is contained in:
parent
c80665a696
commit
509f3a42d7
@ -98,7 +98,7 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
||||
if (videodata->isPaused) {
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
/* Make sure this is the last thing we do before pausing */
|
||||
if (!Android_Window->external_graphics_context) {
|
||||
if (Android_Window && !Android_Window->external_graphics_context) {
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
android_egl_context_backup(Android_Window);
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
@ -122,7 +122,7 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
||||
|
||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
if (!Android_Window->external_graphics_context && !SDL_HasEvent(SDL_EVENT_QUIT)) {
|
||||
if (Android_Window && !Android_Window->external_graphics_context && !SDL_HasEvent(SDL_EVENT_QUIT)) {
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
android_egl_context_restore(Android_Window);
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
@ -130,7 +130,9 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
|
||||
#endif
|
||||
|
||||
/* Make sure SW Keyboard is restored when an app becomes foreground */
|
||||
Android_RestoreScreenKeyboardOnResume(_this, Android_Window);
|
||||
if (Android_Window) {
|
||||
Android_RestoreScreenKeyboardOnResume(_this, Android_Window);
|
||||
}
|
||||
|
||||
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
@ -168,7 +170,7 @@ void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
|
||||
if (backup_context) {
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
if (!Android_Window->external_graphics_context) {
|
||||
if (Android_Window && !Android_Window->external_graphics_context) {
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
android_egl_context_backup(Android_Window);
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
@ -199,7 +201,7 @@ void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||
if (!Android_Window->external_graphics_context && !SDL_HasEvent(SDL_EVENT_QUIT)) {
|
||||
if (Android_Window && !Android_Window->external_graphics_context && !SDL_HasEvent(SDL_EVENT_QUIT)) {
|
||||
SDL_LockMutex(Android_ActivityMutex);
|
||||
android_egl_context_restore(Android_Window);
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
@ -207,7 +209,9 @@ void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
|
||||
#endif
|
||||
|
||||
/* Make sure SW Keyboard is restored when an app becomes foreground */
|
||||
Android_RestoreScreenKeyboardOnResume(_this, Android_Window);
|
||||
if (Android_Window) {
|
||||
Android_RestoreScreenKeyboardOnResume(_this, Android_Window);
|
||||
}
|
||||
|
||||
SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND);
|
||||
SDL_SendWindowEvent(Android_Window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user