Skip to content

Commit

Permalink
Fix temporary hang in strings tool when limit is reached (#217).
Browse files Browse the repository at this point in the history
  • Loading branch information
solemnwarning committed Oct 29, 2023
1 parent dd49761 commit a859201
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Version TBA

* Add copy/export context menu commands to strings tool (#210).

* Fix temporary hang in strings tool when processing large files (#217).

Version 0.60.1 (2023-07-28)

* Install missing parts of binary template plugin.
Expand Down
10 changes: 8 additions & 2 deletions src/StringPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ void REHex::StringPanel::thread_main()

is_really_string = is_i_string(true);

while(!threads_pause && i < data.size() && is_i_string(false) == is_really_string)
while(!threads_pause && !threads_exit && i < data.size() && is_i_string(false) == is_really_string)
{
++num_codepoints;
}

if(threads_pause)
if(threads_pause || threads_exit)
{
/* We are being paused to allow for data being inserted or erased.
* This may invalidate the base and/or length of our window, so we
Expand All @@ -630,6 +630,12 @@ void REHex::StringPanel::thread_main()

--running_threads;

if(threads_exit)
{
--spawned_threads;
return;
}

paused_cv.notify_all();
resume_cv.wait(pl, [this]() { return !threads_pause; });

Expand Down

0 comments on commit a859201

Please sign in to comment.