2025-07-22 00:14 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003373Spring engineGeneralpublic2013-08-24 18:26
Reportercleanrock 
Assigned ToKloot 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version91.0.1+git 
Target VersionFixed in Version 
Summary0003373: crash when exiting before countdown finished
DescriptionWhile investigating 3371 (which i was unable to reproduce on 91.0) i found that spring crash if you exit before countdown finished.
This is because the AI is not created properly until game start and shutdown will try to destroy the non-existing AI since the AI has an id before start:

void CEngineOutHandler::SetSkirmishAIDieing(const size_t skirmishAIId) {
    SCOPED_TIMER("AI Total");

    try {
        id_skirmishAI[skirmishAIId]->Dieing();
    } CATCH_AI_EXCEPTION;
}

Map id_skirmishAI above is empty so we get a new NULL pointer entry.
Steps To Reproduce- start spring
- setup Player vs NullAI game (i used BA 7.72)
- press "Test the game" and exit (Alt+F4) before countdown finished
Additional InformationThis crash started at commit 6b2fd94621d91cfd528e2021bc36a295db00ee72, not sure why though.
I attached an ugly fix for this which checks for null-pointer but i think we need a better fix.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon ugly.patch (938 bytes) 2012-12-17 17:09 -
    diff --git a/rts/ExternalAI/EngineOutHandler.cpp b/rts/ExternalAI/EngineOutHandler.cpp
    index e855688..cdba646 100644
    --- a/rts/ExternalAI/EngineOutHandler.cpp
    +++ b/rts/ExternalAI/EngineOutHandler.cpp
    @@ -132,7 +132,8 @@ CEngineOutHandler::~CEngineOutHandler() {
     		for (id_ai_t::iterator ai = id_skirmishAI.begin(); \
     				ai != id_skirmishAI.end(); ++ai) {         \
     			try {                                          \
    -				ai->second->FUNC;                          \
    +				if (ai->second)                            \
    +					ai->second->FUNC;                      \
     			} CATCH_AI_EXCEPTION;                          \
     		}
     
    @@ -617,7 +618,9 @@ void CEngineOutHandler::SetSkirmishAIDieing(const size_t skirmishAIId) {
     	SCOPED_TIMER("AI Total");
     
     	try {
    -		id_skirmishAI[skirmishAIId]->Dieing();
    +		CSkirmishAIWrapper* aiWrapper = id_skirmishAI[skirmishAIId];
    +		if (aiWrapper)
    +			aiWrapper->Dieing();
     	} CATCH_AI_EXCEPTION;
     }
     
    
    patch file icon ugly.patch (938 bytes) 2012-12-17 17:09 +

-Relationships
has duplicate 0003960closed crash when quitting during countdown to gamestart 
related to 0003371resolvedabma Crash when spring started and closed before game started 
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2012-12-17 17:09 cleanrock New Issue
2012-12-17 17:09 cleanrock File Added: ugly.patch
2012-12-17 17:12 cleanrock Relationship added related to 0003371
2013-08-24 18:14 cleanrock Relationship added has duplicate 0003960
2013-08-24 18:26 Kloot Changeset attached => spring develop fc55c202
2013-08-24 18:26 Kloot Assigned To => Kloot
2013-08-24 18:26 Kloot Status new => resolved
2013-08-24 18:26 Kloot Resolution open => fixed
+Issue History