Introduce a temporary variable, `other_para`, so that we don't end up returning incorrect para (with stale run) inside the output cursor.
From: Jinoh Kang jinoh.kang.kr@gmail.com
Introduce a temporary variable, `other_para`, so that we don't end up returning incorrect para (with stale run) inside the output cursor.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54564 --- dlls/riched20/caret.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index c9fd327e87e..f89770ccc75 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -802,15 +802,18 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) } else { - para = para_next( para ); - if (!para_next( para )) + ME_Paragraph *other_para = para_next( para ); + if (!para_next( other_para )) { if (cursor->run == run) return FALSE; nOffset = 0; break; } - if (para->nFlags & MEPF_ROWSTART) para = para_next( para ); - if (cursor->run == run) run = para_first_run( para ); + if (other_para->nFlags & MEPF_ROWSTART) other_para = para_next( other_para ); + if (cursor->run == run) { + para = other_para; + run = para_first_run( para ); + } nOffset = 0; break; }