diff options
author | Martin Kiewitz | 2010-01-04 22:23:45 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-04 22:23:45 +0000 |
commit | a6aaeb70e6dfb3a9727e8861041601cf658aa5cd (patch) | |
tree | df1510727c3dc67055d89f8c46a26c7d64bd7e1c | |
parent | 05a16d7cba889c3daf947a727917ce2dc9bd1eab (diff) | |
download | scummvm-rg350-a6aaeb70e6dfb3a9727e8861041601cf658aa5cd.tar.gz scummvm-rg350-a6aaeb70e6dfb3a9727e8861041601cf658aa5cd.tar.bz2 scummvm-rg350-a6aaeb70e6dfb3a9727e8861041601cf658aa5cd.zip |
SCI: fix crash due accessing invalid object (implemented deleteScreenitem)
svn-id: r46993
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 10 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 0acc49311b..753fd6f133 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -676,6 +676,10 @@ reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv) { } reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) { + reg_t viewObj = argv[0]; + + s->_gui->deleteScreenItem(viewObj); + /* reg_t viewObj = argv[0]; uint16 viewId = GET_SEL32V(s->_segMan, viewObj, view); diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 48f99ffa51..93a40bb378 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -844,6 +844,16 @@ void SciGui::addScreenItem(reg_t object) { _screenItemCount++; } +void SciGui::deleteScreenItem(reg_t object) { + for (int itemNr = 0; itemNr < _screenItemCount; itemNr++) { + if (_screenItems[itemNr] == object) { + _screenItems.remove_at(itemNr); + _screenItemCount--; + return; + } + } +} + void SciGui::frameOut() { for (int itemNr = 0; itemNr < _screenItemCount; itemNr++) { reg_t viewObj = _screenItems[itemNr]; diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 2017c1b1fe..a81e61d7e9 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -155,6 +155,7 @@ public: // SCI32 virtual void addScreenItem(reg_t object); + virtual void deleteScreenItem(reg_t object); virtual void frameOut(); virtual bool debugUndither(bool flag); |