Fix crash when FrameBuffer message surfaces haven't been created.

The next task is to move all FrameBuffer message-related functionality into its own class.
This commit is contained in:
Stephen Anthony 2021-01-16 15:27:18 -03:30
parent bf5a9e5749
commit 9f74a780ed
1 changed files with 15 additions and 19 deletions

View File

@ -67,10 +67,6 @@ FrameBuffer::FrameBuffer(OSystem& osystem)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::~FrameBuffer()
{
// Make sure to free surfaces/textures before destroying the backend itself
// Most platforms are fine with doing this in either order, but it seems
// that OpenBSD in particular crashes when attempting to destroy textures
// *after* the renderer is already destroyed
cerr << "~FrameBuffer()" << endl << endl;
}
@ -256,21 +252,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
return FBInitStatus::FailTooLarge;
#endif
// Initialize video mode handler, so it can know what video modes are
// appropriate for the requested image size
myVidModeHandler.setImageSize(size);
// Always save, maybe only the mode of the window has changed
saveCurrentWindowPosition();
myBufferType = type;
// Initialize video subsystem
string pre_about = myBackend->about();
FBInitStatus status = applyVideoMode();
if(status != FBInitStatus::Success)
return status;
#ifdef GUI_SUPPORT
#ifdef GUI_SUPPORT // TODO: put message stuff in its own class
// Erase any messages from a previous run
myMsg.enabled = false;
@ -297,6 +279,20 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
}
#endif
// Initialize video mode handler, so it can know what video modes are
// appropriate for the requested image size
myVidModeHandler.setImageSize(size);
// Always save, maybe only the mode of the window has changed
saveCurrentWindowPosition();
myBufferType = type;
// Initialize video subsystem
string pre_about = myBackend->about();
FBInitStatus status = applyVideoMode();
if(status != FBInitStatus::Success)
return status;
// Print initial usage message, but only print it later if the status has changed
if(myInitializedCount == 1)
{