Skip to content

Commit

Permalink
Fix crash in tads on game quit caused by debug code inserting sentinels
Browse files Browse the repository at this point in the history
before allocations but not adjusting for them in deallocation.
  • Loading branch information
spathiwa committed Jun 18, 2015
1 parent c3eb0ef commit e2a4e5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tads/tads2/mcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ mcmcxdef *mcmcini(mcmcx1def *globalctx, uint pages,
/* uninitialize a client context */
void mcmcterm(mcmcxdef *ctx)
{
IF_DEBUG(ctx = (mcmcxdef *)((uchar *)ctx - sizeof(ulong)));

/* delete the context memory */
mchfre(ctx);
}
Expand Down Expand Up @@ -251,6 +253,8 @@ void mcmterm(mcmcx1def *ctx)
* allocated out of the block, so it's the same as the block pointer.
* Freeing the context frees this last/first chunk.
*/
IF_DEBUG(ctx = (mcmcx1def *)((uchar *)ctx - sizeof(ulong)));

mchfre(ctx);
}

Expand Down
1 change: 0 additions & 1 deletion ui/RichTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ - (void)setDelegate:(UIViewController<UIScrollViewDelegate>*)delegate {
}

-(void)dealloc {
NSLog(@"rtv %@ dealloc", self);
if (m_selectionView) {
[m_selectionView removeFromSuperview];
m_selectionView = nil;
Expand Down

0 comments on commit e2a4e5c

Please sign in to comment.