From 6f6c92d470d50344fb5935b4a8cd6159660d8c5b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 24 Dec 2015 01:31:55 +0200 Subject: [PATCH] LAB: Prevent the Image destructor from deleting the drawing buffer --- engines/lab/dispman.cpp | 5 ++++- engines/lab/tilepuzzle.cpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 0f2bc933e8d..e9736a9bf31 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -853,7 +853,10 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String fi } // for i } // for j - delete[] bitMapBuffer; + // Prevent the Image destructor from deleting the drawing buffer + imDest._imageData = nullptr; + + // bitMapBuffer will be deleted by the Image destructor } void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, const Common::String filename) { diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index d39612d49a6..bea2b61ec40 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -327,6 +327,9 @@ void TilePuzzle::changeCombination(uint16 number) { _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _vm->_utils->vgaScaleX(COMBINATION_X[number]), _vm->_utils->vgaScaleY(65), (_numberImages[combnum])->_width, 2, false); } + // Prevent the Image destructor from deleting the display buffer + display._imageData = nullptr; + delete[] buffer; bool unlocked = true;