Skip to content

Fix an issue where WinMerge sometimes crashes when executing "Refresh Selected" in the folder compare window. #1120

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

Merged
merged 1 commit into from
Jan 9, 2022

Conversation

tjmprm77
Copy link
Contributor

@tjmprm77 tjmprm77 commented Jan 9, 2022

In the current version, WinMerge sometimes crashes when executing "Refresh Selected" in the folder compare window.
In my environment, there is a high probability of a crash, especially if the "Include Subfolders" option is on and many items are selected.
For example, the situation is as shown in the image below. The set of directories compared at this time is attached.
RefreshSelected.zip
RefreshSelected

As a result of monitoring this phenomenon, the situation when "Refresh Selected" is executed is as follows.

  • The collection thread DiffThreadCollect() sends the UI update event CDiffThread::EVENT_COLLECT_COMPLETED as soon as it starts because there is nothing to do.
  • In the compare thread, DIFFITEM::RemoveChildren() called from DirScan_UpdateMarkedItems() removes DiffItems.
  • In response to the UI update event CDiffThread::EVENT_COLLECT_COMPLETED, the UI update process such as CDirView::OnUpdateUIMessage () and CDirView::ReflectGetdispinfo() runs on the main thread.
    At this time this process may refer to the deleted DiffItem in the compare thread running in parallel.

This PR fixes this issue by performing the UI update process after the process that may delete DiffItems is completed.

… Selected" in the folder compare window.

- Change to perform UI update process after the process that may delete DiffItems is completed.
  - DirScan_UpdateMarkedItems() is now executed in the collect thread.
  - The compare thread is now processed after the collection thread is completed if "Refresh Selected" is executed.
- Add some assertions.
@sdottaka sdottaka merged commit 6c8e206 into WinMerge:master Jan 9, 2022
@sdottaka
Copy link
Member

sdottaka commented Jan 9, 2022

Thank you!

@sdottaka sdottaka added this to the v2.16.18 milestone Jan 9, 2022
@sdottaka sdottaka added the crash label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants