Skip to content

Commit

Permalink
SCI32: Reset ScreenItem cel type when updating from a VM object
Browse files Browse the repository at this point in the history
In Phant2, when going to email on Curtis's office computer, a
screen item that contained a bitmap on the last frame was updated
to contain a view on the next frame. This crashed the engine when
it tried to reuse the old disposed bitmap instead of the new view
because the cel type was never changed from kCelTypeMem to
kCelTypeView.
  • Loading branch information
csnover committed Apr 23, 2017
1 parent 0655cc1 commit c88a43b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions engines/sci/graphics/screen_item32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,13 @@ void ScreenItem::setFromObject(SegManager *segMan, const reg_t object, const boo
}
}

if (updateBitmap) {
const reg_t bitmap = readSelector(segMan, object, SELECTOR(bitmap));
if (!bitmap.isNull()) {
_celInfo.bitmap = bitmap;
_celInfo.type = kCelTypeMem;
} else {
_celInfo.bitmap = NULL_REG;
_celInfo.type = kCelTypeView;
}
const reg_t bitmap = readSelector(segMan, object, SELECTOR(bitmap));
if (updateBitmap && !bitmap.isNull()) {
_celInfo.bitmap = bitmap;
_celInfo.type = kCelTypeMem;
} else {
_celInfo.bitmap = NULL_REG;
_celInfo.type = kCelTypeView;
}

if (updateCel || updateBitmap) {
Expand Down

0 comments on commit c88a43b

Please sign in to comment.