mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 06:49:33 +00:00
Console: make ConsoleWindow immune to constructor ordering
This commit is contained in:
parent
284126e13c
commit
a5dad80454
@ -25,7 +25,7 @@ using namespace Retro;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::unordered_map<WindowPtr, ConsoleWindow*> windows;
|
std::unordered_map<WindowPtr, ConsoleWindow*> *windows = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title)
|
ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title)
|
||||||
@ -46,14 +46,16 @@ ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title)
|
|||||||
SetPort(port);
|
SetPort(port);
|
||||||
EraseRect(&portRect);
|
EraseRect(&portRect);
|
||||||
|
|
||||||
windows[win] = this;
|
if(!windows)
|
||||||
|
windows = new std::unordered_map<WindowPtr, ConsoleWindow*>();
|
||||||
|
(*windows)[win] = this;
|
||||||
|
|
||||||
Init(port, portRect);
|
Init(port, portRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleWindow::~ConsoleWindow()
|
ConsoleWindow::~ConsoleWindow()
|
||||||
{
|
{
|
||||||
windows.erase(win);
|
windows->erase(win);
|
||||||
DisposeWindow(win);
|
DisposeWindow(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +87,7 @@ char ConsoleWindow::WaitNextChar()
|
|||||||
{
|
{
|
||||||
case updateEvt:
|
case updateEvt:
|
||||||
eventWin = (WindowPtr)event.message;
|
eventWin = (WindowPtr)event.message;
|
||||||
realConsole = windows[(WindowPtr)event.message];
|
realConsole = (*windows)[(WindowPtr)event.message];
|
||||||
if(realConsole)
|
if(realConsole)
|
||||||
{
|
{
|
||||||
Rect updateRect;
|
Rect updateRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user