Skip to content

Commit 3f327b4

Browse files
andyclaude
andcommitted
BuilderApp: return after quit() in OnInit(), same shape as #120's crash
BuilderApp::OnInit()'s solo-viewer startup path has the exact same shape GatewayApp::OnInit() had before 97d4a86: seven call sites, p_builder->quit(false) with no `return`, so a failed check falls through into the next try block instead of stopping startup. Not a live bug today -- Builder::quit() reaches an unconditional _exit(0) whenever there's nothing to save, which is always true this early (no calculation has been loaded yet), so control never actually returns to the caller for the fall-through to matter. But that's incidental to how quit() happens to be written, not something this startup sequence should depend on -- it's one _exit() removal away from being the identical crash. Adding `return false` after every quit() call costs nothing and removes the landmine regardless of whether Builder::quit()'s own behavior ever changes. Audited: only BuilderApp.C and GatewayApp.C share this checkServerSetup()/checkServer()/checkUser() startup template, so no further siblings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E4HPD1xaxKpyh9gZ6hsBP2
1 parent 772cb7d commit 3f327b4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/apps/builder/BuilderApp.C‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,21 @@ bool BuilderApp::OnInit()
141141
EE_RT_ASSERT(FALSE, EE_FATAL, msg);
142142
}
143143

144+
// Defensive, not a fix for an observed crash: GatewayApp::OnInit()
145+
// had this exact shape (quit() called with no `return`, so a failed
146+
// check fell through into the next try block and could call quit()
147+
// again on already-torn-down state -- segfault, #120/97d4a862).
148+
// Builder::quit() currently can't be hit twice this way in practice
149+
// -- with nothing loaded yet (always true this early) it always
150+
// reaches its unconditional _exit(0) rather than returning to the
151+
// caller -- but that's incidental to how quit() happens to be
152+
// written today, not something this startup sequence should rely
153+
// on. Same `return false` after every quit() as the Gateway fix,
154+
// so this can't become the same live bug if quit() ever changes.
144155
try {
145156
if (!checkServerSetup()) {
146157
p_builder->quit(false); // canceled
158+
return false;
147159
}
148160
} catch (RetryException& rex) {
149161
ewxMessageDialog * dlg =
@@ -152,6 +164,7 @@ bool BuilderApp::OnInit()
152164
dlg->ShowModal();
153165
dlg->Destroy();
154166
p_builder->quit(false);
167+
return false;
155168
} catch (EcceException& ex) {
156169
string msg = ex.what();
157170
msg += "Please contact your ECCE Administrator.";
@@ -161,11 +174,13 @@ bool BuilderApp::OnInit()
161174
dlg->ShowModal();
162175
dlg->Destroy();
163176
p_builder->quit(false);
177+
return false;
164178
}
165179

166180
try {
167181
if (!checkServer()) {
168182
p_builder->quit(false); // canceled
183+
return false;
169184
}
170185
} catch (RetryException& rex) {
171186
ewxMessageDialog * dlg =
@@ -174,6 +189,7 @@ bool BuilderApp::OnInit()
174189
dlg->ShowModal();
175190
dlg->Destroy();
176191
p_builder->quit(false);
192+
return false;
177193
} catch (EcceException& ex) {
178194
string msg = "An error has occured while attempting to access "
179195
"the ECCE server. Please contact your administrator for assistence "
@@ -185,10 +201,12 @@ bool BuilderApp::OnInit()
185201
dlg->ShowModal();
186202
dlg->Destroy();
187203
p_builder->quit(false);
204+
return false;
188205
}
189206

190207
if (!checkUser()) {
191208
p_builder->quit(false);
209+
return false;
192210
}
193211
}
194212

0 commit comments

Comments
 (0)