Skip to content

Fix orphaned Patch Manager search on ListModel destruction - #278

Open
kartun83 wants to merge 1 commit into
dsp56300:mainfrom
kartun83:fix/patchmanager-listmodel-destroy-search-leak
Open

Fix orphaned Patch Manager search on ListModel destruction#278
kartun83 wants to merge 1 commit into
dsp56300:mainfrom
kartun83:fix/patchmanager-listmodel-destroy-search-leak

Conversation

@kartun83

@kartun83 kartun83 commented Jul 5, 2026

Copy link
Copy Markdown

Summary

  • ListModel had no destructor, so a search still in flight when the patch manager panel/document is torn down (e.g. closed mid-search) never called cancelSearch() - its handle stayed registered in DB::m_searches forever and the background search job kept running, the same class of bug as the already-fixed Patch Manager search leak, just on a different teardown path.
  • Adds ~ListModel() that calls the existing cancelSearch().

Test plan

  • Added patchDbTest, a standalone console test (mirrors midiLearnTest) verifying: DB::cancelSearch() removes a handle from DB::m_searches; an uncancelled handle stays registered indefinitely (demonstrating the leak this guards against); a ListModel-like RAII owner cancels its search on destruction.
  • patchDbTest built and run locally, all assertions pass.
  • jucePluginEditorLib builds clean with the destructor added.

ListModel had no destructor, so a search still in flight when the panel/document
is torn down (e.g. closed mid-search) never called cancelSearch() - its handle
stayed registered in DB::m_searches forever and the background job kept running,
the same class of bug as the already-fixed Patch Manager search leak, just on a
different teardown path.

Adds patchDbTest, a standalone console test (mirroring midiLearnTest) that
verifies DB::cancelSearch() actually removes a handle, that an uncancelled
handle stays registered indefinitely (demonstrating the leak this guards
against), and that a ListModel-like RAII owner cancels its search on
destruction.
@kartun83
kartun83 force-pushed the fix/patchmanager-listmodel-destroy-search-leak branch from 3d3476b to 5df56a5 Compare July 5, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant