Fixed WindowImplAndroid used after deleted.

This commit is contained in:
acsbendi 2019-04-25 14:16:04 +02:00 committed by Lukas Dürrenberger
parent f3a180bc09
commit 20c23f0007

View File

@ -84,6 +84,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsign
////////////////////////////////////////////////////////////
WindowImplAndroid::~WindowImplAndroid()
{
WindowImplAndroid::singleInstance = NULL;
}
@ -216,22 +217,25 @@ bool WindowImplAndroid::hasFocus() const
////////////////////////////////////////////////////////////
void WindowImplAndroid::forwardEvent(const Event& event)
{
ActivityStates* states = getActivity(NULL);
if (event.type == Event::GainedFocus)
if (WindowImplAndroid::singleInstance != NULL)
{
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window);
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window);
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
WindowImplAndroid::singleInstance->m_hasFocus = true;
}
else if (event.type == Event::LostFocus)
{
WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true;
WindowImplAndroid::singleInstance->m_hasFocus = false;
}
ActivityStates* states = getActivity(NULL);
WindowImplAndroid::singleInstance->pushEvent(event);
if (event.type == Event::GainedFocus)
{
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window);
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window);
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
WindowImplAndroid::singleInstance->m_hasFocus = true;
}
else if (event.type == Event::LostFocus)
{
WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true;
WindowImplAndroid::singleInstance->m_hasFocus = false;
}
WindowImplAndroid::singleInstance->pushEvent(event);
}
}