From e8a13197e3958b7d8472c8519cb060407266eb14 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 7 Oct 2009 22:50:11 +0000 Subject: SCI: Replace SciGuiGfx::mallocPort by 'new GuiPort'; also add FIXMES about ports which are not freed, have no valid ID and are not known to the window mgr svn-id: r44765 --- engines/sci/gui/gui_gfx.cpp | 15 ++++++--------- engines/sci/gui/gui_gfx.h | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 81c126dbd3..1cfe3f3a5a 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -51,24 +51,21 @@ void SciGuiGfx::init() { _textFonts = NULL; _textFontsCount = 0; _textColors = NULL; _textColorsCount = 0; - _mainPort = mallocPort(); + // FIXME: _mainPort is never freed + // FIXME: _mainPort has no id, and is not known to the WindowManager -- this could lead to problems + _mainPort = new GuiPort(0); SetPort(_mainPort); OpenPort(_mainPort); - _menuPort = mallocPort(); + // FIXME: _menuPort is never freed + // FIXME: _menuPort has no id, and is not known to the WindowManager -- this could lead to problems + _menuPort = new GuiPort(0); OpenPort(_menuPort); SetFont(0); _menuPort->rect = Common::Rect(0, 0, _screen->_width, _screen->_height); _menuRect = Common::Rect(0, 0, _screen->_width, 9); } -GuiPort *SciGuiGfx::mallocPort() { - GuiPort *newPort = (GuiPort *)malloc(sizeof(GuiPort)); - assert(newPort); - memset(newPort, 0, sizeof(GuiPort)); - return newPort; -} - GuiPort *SciGuiGfx::SetPort(GuiPort *newPort) { GuiPort *oldPort = _curPort; _curPort = newPort; diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 05ef4d46b5..0caa317e83 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -46,7 +46,6 @@ public: void init(void); - GuiPort *mallocPort (); byte *GetSegment(byte seg); void ResetScreen(); -- cgit v1.2.3