aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-08-14 08:03:32 +0000
committerMartin Kiewitz2010-08-14 08:03:32 +0000
commitf8697e20b50607e93df0cf3ddf725d6fee6360cf (patch)
treead7dbe813581879fe2d578f8727363851b06b70d
parent512bf22af689a9fec0f1dc3a637f6f2e084b06a7 (diff)
downloadscummvm-rg350-f8697e20b50607e93df0cf3ddf725d6fee6360cf.tar.gz
scummvm-rg350-f8697e20b50607e93df0cf3ddf725d6fee6360cf.tar.bz2
scummvm-rg350-f8697e20b50607e93df0cf3ddf725d6fee6360cf.zip
SCI: now reusing window ids on kNewWindow
sq4cd recreates the inventory window several times, but also reuses old window ids, causing kernelSetActive errors. fixes bug #3044757 svn-id: r52079
-rw-r--r--engines/sci/graphics/ports.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index 2d8bfde37d..dddd9b1c86 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -288,6 +288,16 @@ Window *GfxPorts::addWindow(const Common::Rect &dims, const Common::Rect *restor
// Find an unused window/port id
uint id = PORTS_FIRSTWINDOWID;
while (id < _windowsById.size() && _windowsById[id]) {
+ if (_windowsById[id]->counterTillFree) {
+ // port that is already disposed, but not freed yet
+ freeWindow((Window *)_windowsById[id]);
+ _freeCounter--;
+ break; // reuse the handle
+ // we do this especially for sq4cd. it creates and disposes the
+ // inventory window all the time, but reuses old handles as well
+ // this worked somewhat under the original interpreter, because
+ // it put the new window where the old was.
+ }
++id;
}
if (id == _windowsById.size())