diff options
author | Matthew Hoops | 2013-04-16 11:14:04 -0400 |
---|---|---|
committer | Matthew Hoops | 2013-04-16 11:14:04 -0400 |
commit | 8a50d8744570e7a426c76cd0ed00c5db671fd366 (patch) | |
tree | df1b0face8c89eeccc16c87247e1f6fa955f0bd9 /engines/sci | |
parent | 6c1b0190563666608aecb56daed4d192d3e31169 (diff) | |
download | scummvm-rg350-8a50d8744570e7a426c76cd0ed00c5db671fd366.tar.gz scummvm-rg350-8a50d8744570e7a426c76cd0ed00c5db671fd366.tar.bz2 scummvm-rg350-8a50d8744570e7a426c76cd0ed00c5db671fd366.zip |
SCI: Fix potential memory leak with Mac cursor's hotspot
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 8 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/cursor.h | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index a65bcc215e..e4b3028bcd 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -185,10 +185,12 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16()); // Fallthrough case 3: - if (g_sci->getPlatform() == Common::kPlatformMacintosh) - g_sci->_gfxCursor->kernelSetMacCursor(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); - else + if (g_sci->getPlatform() == Common::kPlatformMacintosh) { + delete hotspot; // Mac cursors have their own hotspot, so ignore any we get here + g_sci->_gfxCursor->kernelSetMacCursor(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16()); + } else { g_sci->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); + } break; case 10: // Freddy pharkas, when using the whiskey glass to read the prescription (bug #3034973) diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 40d5958588..fe2aefd689 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -481,7 +481,7 @@ void GfxCursor::kernelMoveCursor(Common::Point pos) { _event->getSciEvent(SCI_EVENT_PEEK); } -void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot) { +void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum) { // Here we try to map the view number onto the cursor. What they did was keep the // kSetCursor calls the same, but perform remapping on the cursors. They also took // it a step further and added a new kPlatform sub-subop that handles remapping diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h index ac928f50bb..369bd22a0b 100644 --- a/engines/sci/graphics/cursor.h +++ b/engines/sci/graphics/cursor.h @@ -60,7 +60,7 @@ public: bool isVisible(); void kernelSetShape(GuiResourceId resourceId); void kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot); - void kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum, Common::Point *hotspot); + void kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNum); void setPosition(Common::Point pos); Common::Point getPosition(); void refreshPosition(); |