From c623a767676f8422186933c87b569d39185b5496 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 13 Aug 2016 09:02:28 +0200 Subject: MOHAWK: Ensure constructing and deleting cards does not have side effects --- engines/mohawk/riven.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'engines/mohawk/riven.cpp') diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 8b7ee885ae..e6d8a16811 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -384,7 +384,10 @@ void MohawkEngine_Riven::changeToCard(uint16 dest) { } } - delete _card; + if (_card) { + _card->leave(); + delete _card; + } _card = new RivenCard(this, dest); refreshCard(); // Handles hotspots and scripts @@ -394,7 +397,7 @@ void MohawkEngine_Riven::refreshCard() { // Clear any timer still floating around removeTimer(); - _card->open(); + _card->enter(); if (_showHotspots) _card->drawHotspotRects(); -- cgit v1.2.3