Port PythonExceptionSender and install it at boot as 40250 Main does
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3dfb09df92
commit
ff71726ff0
@@ -14,6 +14,7 @@
|
||||
#include "../EterLib/HostCursor.h"
|
||||
#include "UserInterface/PythonNetworkStream.h"
|
||||
#include "UserInterface/AccountConnector.h"
|
||||
#include "UserInterface/PythonExceptionSender.h"
|
||||
#include "UserInterface/ServerStateChecker.h"
|
||||
#include "UserInterface/PythonPlayer.h"
|
||||
#include "GameLib/FlyingObjectManager.h"
|
||||
@@ -70,6 +71,8 @@ namespace
|
||||
{
|
||||
// 40250 has this on Main()'s stack. CPythonLauncher is a CSingleton, so there is still only ever one.
|
||||
std::unique_ptr<CPythonLauncher> g_launcher;
|
||||
// 40250 Main(): CPythonExceptionSender pyExceptionSender; SetExceptionSender(&pyExceptionSender);
|
||||
std::unique_ptr<CPythonExceptionSender> g_exception_sender;
|
||||
std::unique_ptr<UI::CWindowManager> g_window_manager;
|
||||
std::unique_ptr<CPythonResource> g_resource;
|
||||
// 40250 CPythonApplication::m_timer; CSlotWindow's cool time and Process() read it via Instance().
|
||||
@@ -733,6 +736,8 @@ bool Start(const char* stdlib_path, std::string* error)
|
||||
PythonHost::Configure();
|
||||
|
||||
g_launcher = std::make_unique<CPythonLauncher>(); // Py_Initialize
|
||||
g_exception_sender = std::make_unique<CPythonExceptionSender>();
|
||||
SetExceptionSender(g_exception_sender.get());
|
||||
// The script fiber (RunMainScript) is a second OS thread; 2.7 creates the GIL lazily.
|
||||
PyEval_InitThreads();
|
||||
if (!g_launcher->Create())
|
||||
@@ -1071,6 +1076,9 @@ void Stop()
|
||||
g_window_manager.reset();
|
||||
g_resource.reset();
|
||||
g_timer.reset();
|
||||
// PORT: 40250 leaves g_pkExceptionSender dangling once Main() returns; Boot can run again here.
|
||||
SetExceptionSender(NULL);
|
||||
g_exception_sender.reset();
|
||||
g_launcher.reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user