Hopefully fixed rare crash in createVideoModeList.

Assume that the window was null.
This commit is contained in:
Deve 2017-09-30 23:43:29 +02:00
parent d99b2d4b5a
commit 1a250c5b74
3 changed files with 17 additions and 0 deletions

View File

@ -33,6 +33,16 @@ bool CIrrDeviceAndroid::IsPaused = true;
bool CIrrDeviceAndroid::IsFocused = false;
bool CIrrDeviceAndroid::IsStarted = false;
// Execution of android_main() function is a kind of "onCreate" event, so this
// function should be used there to make sure that global window state variables
// have their default values on startup.
void CIrrDeviceAndroid::onCreate()
{
IsPaused = true;
IsFocused = false;
IsStarted = false;
}
//! constructor
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param),

View File

@ -96,6 +96,8 @@ namespace irr
private:
core::position2d<s32> CursorPos;
};
static void onCreate();
private:
android_app* Android;

View File

@ -21,6 +21,8 @@
#include "graphics/irr_driver.hpp"
#include "utils/log.hpp"
#include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h"
extern int main(int argc, char *argv[]);
struct android_app* global_android_app;
@ -62,6 +64,9 @@ void android_main(struct android_app* app)
app_dummy();
// Initialize global Android window state variables
CIrrDeviceAndroid::onCreate();
override_default_params();
global_android_app = app;