Repository navigation
Grep のエラーで戻る経路でも、Grep 実行中のフラグ・操作ブロックを片付ける - #2879
Merged
berryzplus merged 1 commit intoNov 19, 2026
Merged
Conversation
Test Results2 088 tests ±0 2 088 ✅ ±0 12m 20s ⏱️ + 2m 39s Results for commit 94fb7b1. ± Comparison against base commit e4e4ff3. This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both. |
|
berryzplus
approved these changes
Nov 19, 2026
| } | ||
| this->m_bGrepRunning = false; | ||
| pcViewDst->m_bDoing_UndoRedo = false; | ||
| pcViewDst->SetUndoBuffer(); |
Contributor
There was a problem hiding this comment.
(指摘じゃないです。)
- なんで1個だけ
this->なの? - ここでアンドゥ・リドゥフラグを落とすのは適切?
- Grep操作って「元に戻せる」んだっけ?
という普通の指摘を「かつてはしていた」ような。
この Pull Request の場合だと「他と同じ処理をすべきなのに抜けている」を補うのが主題なので、「そういう指摘をすべきじゃない」のも分かるんだけど、つまるところ「誰も突っ込んで来なかったからこうなってる」と予想されるので、レビューするときに突っ込まないのも違うような気がするわけで。
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



タイトル: Grep のエラーで戻る経路でも、Grep 実行中のフラグ・操作ブロックを片付ける
CGrepAgent::DoGrep()は、始めに Grep 実行中のフラグを立て、出力先のビューのm_bDoing_UndoRedoを立て、操作ブロックをAddRef()します。途中で 0 を返す経路は、この 3 つを戻してから戻りますが、2 か所で抜けていました。
:HWND:のエラーの経路: 3 つとも戻していませんでした。同じウィンドウでもう一度 Grep すると、再入として扱われて落ちていました
SetUndoBuffer()だけを呼んでいませんでした(マクロの Grep 置換でクリップボードが取れないとき、出力先のビューの検索語・検索オプションを書き換えない #2876 のレビューでいただいた指摘)変更内容
:HWND:のエラーの経路で、return 0の前にm_bGrepRunning = false・m_bDoing_UndoRedo = false・SetUndoBuffer()を足しました。エラーの文言を出力先に足した後で片付けます(文言の足し方は今と同じ)SetUndoBuffer()を足しましたDoGrep()の 0 を返す経路は、すべて同じ形で片付けますテスト
GrepCommandLineTest.DISABLED_InvalidHwndTargetResetsRunningFlagを有効にしましたm_bDoing_UndoRedoが倒れ、操作ブロックが残らないこと、同じウィンドウでもう一度 Grep できることを確かめますASSERT_THATは、再入の確かめが例外を投げる形になったのでEXPECT_THATにしましたマクロの Grep 置換でクリップボードが取れないとき、出力先のビューの検索語・検索オプションを書き換えない #2876 で足した
ReplaceWithEmptyClipboardKeepsViewSearchは、最後に操作ブロックを片付けるのをやめ、操作ブロックが残らないことを確かめる形にしましたGrepOutputTargetTest.HwndErrorToTargetのコメントから、直した不具合の説明を消しましたGrepCommandLineTest・GrepOutputTargetTestの 73 件が成功しました(無効 0 件。Win32 Debug)直す前は、追加・変更したテストが落ちることを確かめました
手で確かめました(Win32 Debug)
:HWND:のエラーで、Grep 実行中のフラグ・操作ブロックを戻さずに戻る #2877 の再現の手順(-GFILE=":HWND:0" -GOPT=Hで起動し、そのウィンドウで Grep): 落ちずに、同じウィンドウに結果が出る-GOPT=Hなしで同じ起動:HWND handle error.が出て、その後の入力を元に戻せる。その後の Grep も落ちないGrepReplace(0x100000): エラーが出て、ファイルは変わらず、開いたウィンドウで入力を元に戻せる関連 issue, PR
:HWND:のエラーで、Grep 実行中のフラグ・操作ブロックを戻さずに戻る #2877