Skip to content

Commit a0d21aa

Browse files
committed
Merge branch 'bugfix-13568' into develop
2 parents 9bcc8dd + adb1f81 commit a0d21aa

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

docs/notes/bugfix-13568.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Extra undo of paint tools crashes live code

engine/src/image_rep_mutable.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,13 +1943,19 @@ void MCMutableImageRep::image_undo(Ustruct *us)
19431943
{
19441944
if (state & CS_DRAW)
19451945
return;
1946-
1947-
MCImageFreeBitmap(m_bitmap);
1948-
m_bitmap = m_undo_image;
1949-
m_undo_image = nil;
1950-
1951-
// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
1952-
m_owner->invalidate_rep(rect);
1946+
1947+
// PM-2014-10-01: [[ Bug 13568 ]] Make sure that pressing undo (cmd+z) twice when using paint tools, the second undo undoes the first one.
1948+
MCImageBitmap *t_old_bitmap;
1949+
MCImageCopyBitmap(m_bitmap, t_old_bitmap);
1950+
1951+
MCImageFreeBitmap(m_bitmap);
1952+
m_bitmap = m_undo_image;
1953+
m_undo_image = nil;
1954+
/* UNCHECKED */ MCImageCopyBitmap(t_old_bitmap, m_undo_image);
1955+
1956+
// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
1957+
m_owner->invalidate_rep(rect);
1958+
19531959
}
19541960

19551961
void MCMutableImageRep::image_freeundo(Ustruct *us)

0 commit comments

Comments
 (0)