Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -954,8 +954,8 @@ ControlBar::~ControlBar( void )
{
m_scienceLayout->destroyWindows();
deleteInstance(m_scienceLayout);
m_scienceLayout = NULL;
}
m_scienceLayout = NULL;
m_genArrow = NULL;
if(m_videoManager)
delete m_videoManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ void ResetDiplomacy( void )
theLayout->destroyWindows();
deleteInstance(theLayout);
InitBuddyControls(-1);
theLayout = NULL;
}
theLayout = NULL;
theWindow = NULL;
if (theAnimateWindowManager)
delete theAnimateWindowManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,12 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg
pref.write();
//TheScriptEngine->setGlobalDifficulty(s_AIDiff); // CANNOT DO THIS! REPLAYS WILL BREAK!
WindowLayout *layout = window->winGetLayout();
layout->destroyWindows();
deleteInstance(layout);
if (layout)
{
layout->destroyWindows();
deleteInstance(layout);
}

setupGameStart(TheCampaignManager->getCurrentMap(), s_AIDiff);
// start the game
}
Expand All @@ -268,8 +272,11 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg
TheCampaignManager->setCampaign( AsciiString::TheEmptyString );
TheWindowManager->winUnsetModal(window);
WindowLayout *layout = window->winGetLayout();
layout->destroyWindows();
deleteInstance(layout);
if (layout)
{
layout->destroyWindows();
deleteInstance(layout);
}

}
else if ( controlID == radioButtonEasyAIID )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ static void closeDownloadWindow( void )
if (!parent)
return;

WindowLayout *menuLayout = parent->winGetLayout();
menuLayout->runShutdown();
menuLayout->destroyWindows();
deleteInstance(menuLayout);
menuLayout = NULL;
WindowLayout *menuLayout = parent->winGetLayout();
if (menuLayout)
{
menuLayout->runShutdown();
menuLayout->destroyWindows();
deleteInstance(menuLayout);
menuLayout = NULL;
}

GameWindow *mainWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("MainMenu.wnd:MainMenuParent") );
if (mainWin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,13 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
else if ( controlID == buttonBack )
{

mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
if (mapSelectLayout)
{
mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
}

// set the controls to NULL since they've been destroyed.
NullifyControls();
showLANGameOptionsUnderlyingGUIElements(TRUE);
Expand Down Expand Up @@ -390,9 +394,12 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
}


mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
if (mapSelectLayout)
{
mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
}

// set the controls to NULL since they've been destroyed.
NullifyControls();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,13 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms

if( controlID == buttonOkID )
{
WindowLayout *popupCommunicatorLayout = window->winGetLayout();
popupCommunicatorLayout->destroyWindows();
deleteInstance(popupCommunicatorLayout);
popupCommunicatorLayout = NULL;
WindowLayout *popupCommunicatorLayout = window->winGetLayout();
if (popupCommunicatorLayout)
{
popupCommunicatorLayout->destroyWindows();
deleteInstance(popupCommunicatorLayout);
popupCommunicatorLayout = NULL;
}
} // end if

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ void destroyQuitMenu()
{
fullQuitMenuLayout->destroyWindows();
deleteInstance(fullQuitMenuLayout);
fullQuitMenuLayout = NULL;
}
fullQuitMenuLayout = NULL;
if(noSaveLoadQuitMenuLayout)
{
noSaveLoadQuitMenuLayout->destroyWindows();
deleteInstance(noSaveLoadQuitMenuLayout);
noSaveLoadQuitMenuLayout = NULL;
}
noSaveLoadQuitMenuLayout = NULL;
quitMenuLayout = NULL;
isVisible = FALSE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,12 @@ void finishSinglePlayerInit( void )
TheInGameUI->freeMessageResources();

//
s_blankLayout->destroyWindows();
deleteInstance(s_blankLayout);
s_blankLayout = NULL;
if (s_blankLayout)
{
s_blankLayout->destroyWindows();
deleteInstance(s_blankLayout);
s_blankLayout = NULL;
}

// set keyboard focus to main parent
TheWindowManager->winSetFocus( parent );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,13 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn
{
showSkirmishGameOptionsUnderlyingGUIElements(TRUE);

skirmishMapSelectLayout->destroyWindows();
deleteInstance(skirmishMapSelectLayout);
skirmishMapSelectLayout = NULL;
if (skirmishMapSelectLayout)
{
skirmishMapSelectLayout->destroyWindows();
deleteInstance(skirmishMapSelectLayout);
skirmishMapSelectLayout = NULL;
}

skirmishPositionStartSpots();
//TheShell->pop();
//do you need this ??
Expand Down Expand Up @@ -583,9 +587,12 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn
skirmishPositionStartSpots();
skirmishUpdateSlotList();

skirmishMapSelectLayout->destroyWindows();
deleteInstance(skirmishMapSelectLayout);
skirmishMapSelectLayout = NULL;
if (skirmishMapSelectLayout)
{
skirmishMapSelectLayout->destroyWindows();
deleteInstance(skirmishMapSelectLayout);
skirmishMapSelectLayout = NULL;
}
//TheShell->pop();

} // end if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,13 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
{
showGameSpyGameOptionsUnderlyingGUIElements( TRUE );

WOLMapSelectLayout->destroyWindows();
deleteInstance(WOLMapSelectLayout);
WOLMapSelectLayout = NULL;
if (WOLMapSelectLayout)
{
WOLMapSelectLayout->destroyWindows();
deleteInstance(WOLMapSelectLayout);
WOLMapSelectLayout = NULL;
}

WOLPositionStartSpots();
} // end if
else if ( controlID == radioButtonSystemMapsID )
Expand Down Expand Up @@ -445,9 +449,12 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
WOLDisplaySlotList();
WOLDisplayGameOptions();

WOLMapSelectLayout->destroyWindows();
deleteInstance(WOLMapSelectLayout);
WOLMapSelectLayout = NULL;
if (WOLMapSelectLayout)
{
WOLMapSelectLayout->destroyWindows();
deleteInstance(WOLMapSelectLayout);
WOLMapSelectLayout = NULL;
}

showGameSpyGameOptionsUnderlyingGUIElements( TRUE );

Expand Down
17 changes: 10 additions & 7 deletions Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,18 @@ void Shell::doPop( Bool impendingPush )

// there better be a top of the stack since we're popping
DEBUG_ASSERTCRASH( currentTop, ("Shell: No top of stack and we want to pop!\n") );

// remove this screen from our list
unlinkScreen( currentTop );

// delete all the windows in the screen
currentTop->destroyWindows();
if (currentTop)
{
// remove this screen from our list
unlinkScreen(currentTop);

// delete all the windows in the screen
currentTop->destroyWindows();

// release the screen object back to the memory pool
deleteInstance(currentTop);
// release the screen object back to the memory pool
deleteInstance(currentTop);
}

// run the init for the new top of the stack if present
WindowLayout *newTop = top();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ void WindowLayout::removeWindow( GameWindow *window )
//-------------------------------------------------------------------------------------------------
void WindowLayout::destroyWindows( void )
{
if (this == NULL)
{
return;
}
GameWindow *window;

while( (window = getFirstWindow()) != 0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ ControlBar::~ControlBar( void )
{
m_scienceLayout->destroyWindows();
deleteInstance(m_scienceLayout);
m_scienceLayout = NULL;
}
m_scienceLayout = NULL;
m_genArrow = NULL;
if(m_videoManager)
delete m_videoManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ void ResetDiplomacy( void )
theLayout->destroyWindows();
deleteInstance(theLayout);
InitBuddyControls(-1);
theLayout = NULL;
}
theLayout = NULL;
theWindow = NULL;
if (theAnimateWindowManager)
delete theAnimateWindowManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,12 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg
pref.write();
//TheScriptEngine->setGlobalDifficulty(s_AIDiff); // CANNOT DO THIS! REPLAYS WILL BREAK!
WindowLayout *layout = window->winGetLayout();
layout->destroyWindows();
deleteInstance(layout);
if (layout)
{
layout->destroyWindows();
deleteInstance(layout);
}

setupGameStart(TheCampaignManager->getCurrentMap(), s_AIDiff);
// start the game
}
Expand All @@ -268,8 +272,11 @@ WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg
TheCampaignManager->setCampaign( AsciiString::TheEmptyString );
TheWindowManager->winUnsetModal(window);
WindowLayout *layout = window->winGetLayout();
layout->destroyWindows();
deleteInstance(layout);
if (layout)
{
layout->destroyWindows();
deleteInstance(layout);
}

}
else if ( controlID == radioButtonEasyAIID )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ static void closeDownloadWindow( void )
if (!parent)
return;

WindowLayout *menuLayout = parent->winGetLayout();
menuLayout->runShutdown();
menuLayout->destroyWindows();
deleteInstance(menuLayout);
menuLayout = NULL;
WindowLayout *menuLayout = parent->winGetLayout();
if (menuLayout)
{
menuLayout->runShutdown();
menuLayout->destroyWindows();
deleteInstance(menuLayout);
menuLayout = NULL;
}

GameWindow *mainWin = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY("MainMenu.wnd:MainMenuParent") );
if (mainWin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,13 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
else if ( controlID == buttonBack )
{

mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
if (mapSelectLayout)
{
mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
}

// set the controls to NULL since they've been destroyed.
NullifyControls();
showLANGameOptionsUnderlyingGUIElements(TRUE);
Expand Down Expand Up @@ -390,9 +394,12 @@ WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg
}


mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
if (mapSelectLayout)
{
mapSelectLayout->destroyWindows();
deleteInstance(mapSelectLayout);
mapSelectLayout = NULL;
}

// set the controls to NULL since they've been destroyed.
NullifyControls();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,13 @@ WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt ms

if( controlID == buttonOkID )
{
WindowLayout *popupCommunicatorLayout = window->winGetLayout();
popupCommunicatorLayout->destroyWindows();
deleteInstance(popupCommunicatorLayout);
popupCommunicatorLayout = NULL;
WindowLayout *popupCommunicatorLayout = window->winGetLayout();
if (popupCommunicatorLayout)
{
popupCommunicatorLayout->destroyWindows();
deleteInstance(popupCommunicatorLayout);
popupCommunicatorLayout = NULL;
}
} // end if

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ void destroyQuitMenu()
{
fullQuitMenuLayout->destroyWindows();
deleteInstance(fullQuitMenuLayout);
fullQuitMenuLayout = NULL;
}
fullQuitMenuLayout = NULL;
if(noSaveLoadQuitMenuLayout)
{
noSaveLoadQuitMenuLayout->destroyWindows();
deleteInstance(noSaveLoadQuitMenuLayout);
noSaveLoadQuitMenuLayout = NULL;
}
noSaveLoadQuitMenuLayout = NULL;
quitMenuLayout = NULL;
isVisible = FALSE;
}
Expand Down
Loading