-
Notifications
You must be signed in to change notification settings - Fork 191
Fix SIGSEGV in CFileNameManager caused by stale share data pointer across test suites #2534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f8e9a51
SetUpShareDataに言語環境の初期化を含める
berryzplus 4a9c4b9
TrayWndテストの実装を見直す
berryzplus c38801c
TrayWndのメッセージ配送をテストする(1/2)
berryzplus 9c16c18
メニュークリックをテストできるようにする
berryzplus 64baadd
トレイメニュークリックのテストを追加する
berryzplus cc11a10
WM_HELPハンドラの定義を修正する
berryzplus c63c151
MYWM_HTMLHELPハンドラの定義を修正する
berryzplus c35dede
SonarQube指摘対応 Merge this "if" statement with the enclosing one.
berryzplus 6ef32b7
SonarQube指摘対応 Make the type of this variable a pointer-to-const.
berryzplus 043007d
SonarQube指摘対応 Use the init-statement
berryzplus 8f800ba
Initial plan
Copilot 108bd8c
Merge feature/improve_traywnd_test with CFileNameManager fix
Copilot 844aa27
CFileNameManagerのm_pShareDataキャッシュを排除して共有データ直接参照に変更する
Copilot 239e5d7
Fix typo in comment: 表示しする -> 表示する
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「このクラスがシングルトンであること」が誤り。
前提
シングルトンクラスは、状態を持ってはならない。
いつ生成しても不変なオブジェクトを何度も生成しないための仕組みがシングルトン。
2つ以上の状態を持つオブジェクトをシングルトンにしてはならない。
TSingleton テンプレート利用クラスのほとんどがこれにあたるので、本当は直さないといけない。
この修正の趣旨
状態変数 m_pShareData の代わりに GetDllShareDataPtr() を使う。
ダメ出しポイント
もともと、状態変数 m_pShareData は絶対 NULL にならない。
したがって、m_pShareData が NULL だった場合のガードは存在しない。
GetDllShareData() は NULL を返し得る関数 として定義している。
この関数の戻り値は deref する前にNULLチェックする必要がある。
つまり、こうなる。
仕様上NULLにならないからチェックしてないコード。
↓
仕様上NULLになり得るけど移行した結果チェックが漏れたコード。