0ad/binaries/data/mods/public/gui/session/message_box/QuitConfirmationReplay.js
Vantha d0a03df2a6 Only call Engine.EndGame right before closing
Since #7786, the GUI tick completed normally after calling
closePageCallback instead of being cancelled like previously. Since
Engine.EndGame deletes the internal g_Game pointer, every Engine call
after it that tried to access g_Game caused a segfault.
This patch solves it by moving Engine.EndGame to the very end, right
before closing the session page.
2026-06-11 21:21:55 +02:00

36 lines
1.1 KiB
JavaScript

/**
* This class is concerned with opening a message box if the game is in replaymode and that replay ended.
*/
class QuitConfirmationReplay extends QuitConfirmation
{
constructor(closePageCallback)
{
super();
Engine.GetGUIObjectByName("session").onReplayFinished = this.display.bind(this, closePageCallback);
}
}
QuitConfirmationReplay.prototype.Title =
translateWithContext("replayFinished", "Confirmation");
QuitConfirmationReplay.prototype.Caption =
translateWithContext("replayFinished", "The replay has finished. What do you want to do?");
QuitConfirmationReplay.prototype.Buttons =
[
{
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Stay"),
"onPress": resumeGame
},
{
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Quit and View Summary"),
"onPress": () => getNextPageOpenRequest(true)
},
{
// Translation: Shown in the Dialog that shows up when a replay finishes
"caption": translate("Quit"),
"onPress": () => getNextPageOpenRequest(false)
}
];