https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a65ebc8a71569a5c3da32fa046cea83902cec91f

commit a65ebc8a71569a5c3da32fa046cea83902cec91f
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Sat Nov 18 11:37:34 2023 +0900
Commit:     Katayama Hirofumi MZ <[email protected]>
CommitDate: Sat Nov 18 11:37:43 2023 +0900

    [MSPAINT] Fix PushImageForUndo (follow-up of 7c0615f)
    
    CORE-19226, CORE-19237
---
 base/applications/mspaint/history.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/base/applications/mspaint/history.cpp 
b/base/applications/mspaint/history.cpp
index 6077b7c5c43..f56981a2bb6 100644
--- a/base/applications/mspaint/history.cpp
+++ b/base/applications/mspaint/history.cpp
@@ -130,11 +130,10 @@ void ImageModel::PushImageForUndo(HBITMAP hbm)
         return;
     }
 
-    INT iNextItem = (m_currInd + 1) % HISTORYSIZE;
-    ::DeleteObject(m_hBms[iNextItem]);
+    ::DeleteObject(m_hBms[m_currInd]);
     m_hBms[m_currInd] = m_hbmMaster;
     m_hbmMaster = hbm;
-    m_currInd = iNextItem;
+    m_currInd = (m_currInd + 1) % HISTORYSIZE; // Go next
     ::SelectObject(m_hDrawingDC, m_hbmMaster); // Re-select
 
     if (m_undoSteps < HISTORYSIZE - 1)

Reply via email to