, __correspondFrameControlHandle()
, __sceneTransitionProgressing(false)
, __pDisabledForm(null)
+ , __destroyPendingScene(L"")
{
for (int i = 0; i < FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_MAX; i++)
{
switch (eventType)
{
case _SceneControlEventArg::SCENE_CONTROL_EVENT_TYPE_DESTROY:
- DestroyScene(sceneId);
+ if (!__destroyPendingScene.IsEmpty())
+ {
+ SysTryLog(NID_UI_SCENES, __destroyPendingScene == sceneId, "Abnormal! __destroyPendingScene != sceneId");
+ DestroyScene(sceneId);
+ if (__destroyPendingScene == sceneId)
+ {
+ __destroyPendingScene.Clear();
+ }
+ }
+ else
+ {
+ SysSecureLog(NID_UI_SCENES, "The Scene was already destroyed on the GotoScene.");
+ }
break;
default:
// 2. Find the Scene on SceneContainer - Scene and correspond UI control has same life time.
pScene = GetSceneFromContainer(sceneId);
+
+ // If the destination Scene is pending to destroy then destroy and invalidate the pScene
+ if (pScene && !__destroyPendingScene.IsEmpty())
+ {
+ if (sceneId == __destroyPendingScene)
+ {
+ __destroyPendingScene.Clear();
+ DestroyScene(sceneId);
+ pScene = null;
+ SysLog(NID_UI_SCENES, "DestroySceneAsync not finished, Do force destroy.");
+ }
+ }
+
if (pScene) // Activate pScene: Scene already existing then Re-activate associated a Form and a Panel.
{
sceneAlreadyCreated = true;
SysTryReturnVoidResult(NID_UI_SCENES, pArg != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
__sceneControlEvent.FireAsync(*pArg);
+ __destroyPendingScene = sceneId;
}
void