Skip to content

Fix volume asset dropdown not populated and crash when no volume selected in Match Template panel#41

Draft
bHimes with Copilot wants to merge 3 commits into
masterfrom
copilot/fix-40
Draft

Fix volume asset dropdown not populated and crash when no volume selected in Match Template panel#41
bHimes with Copilot wants to merge 3 commits into
masterfrom
copilot/fix-40

Conversation

Copilot AI commented Sep 4, 2025

Copy link
Copy Markdown

This PR fixes two related issues in the Match Template panel:

  1. Volume assets not appearing in dropdown when switching workflows
  2. Application crash when attempting to run with no volume selected

Root Cause

The primary issue was in the DirtyVolumes() and DirtyImageGroups() methods in MainFrame.cpp, which only marked template matching panels as dirty when the current workflow was "Template Matching":

if ( current_workflow == "Template Matching" ) {
    match_template_panel->volumes_are_dirty = true;
}

This created a scenario where:

  1. User opens a project while in "Single Particle Analysis" workflow
  2. Volume and image group dropdowns for Match Template panel are never populated
  3. User switches to "Template Matching" workflow
  4. Dropdowns remain empty because they were never marked dirty
  5. User clicks "Run" without being able to select a volume → crash

Stack Trace Analysis

The crash occurred because ReferenceSelectPanel->GetSelection() returns -1 when no item is selected, which gets passed to volume_asset_panel->ReturnAssetPointer(-1), triggering a debug assert:

Requesting an asset (-1) that doesn't exist!
Failed Assert at ../../../src/core/assets.cpp:1071
VolumeAsset *VolumeAssetList::ReturnVolumeAssetPointer(long)

Solution

1. Fixed workflow-dependent dirty flag setting:

  • Modified DirtyVolumes() and DirtyImageGroups() to always mark template matching panels as dirty, regardless of current workflow
  • This ensures dropdowns are properly populated when users switch to Template Matching workflow

2. Added validation to prevent crashes:

  • Added volume selection check in OnUpdateUI() to disable run button when no volume is selected
  • Added safety check in StartEstimationClick() with user-friendly error message

Changes Made

  • src/gui/MainFrame.cpp: Fixed workflow-dependent dirty flag setting
  • src/gui/MatchTemplatePanel.cpp: Added volume selection validation and safety checks

All changes are minimal and surgical, addressing only the specific issues without affecting existing functionality.

Fixes #40.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits September 4, 2025 11:23
Co-authored-by: bHimes <3077528+bHimes@users.noreply.github.com>
…kflows [skip ci]

Co-authored-by: bHimes <3077528+bHimes@users.noreply.github.com>
Copilot AI changed the title [WIP] volume asset not there Fix volume asset dropdown not populated and crash when no volume selected in Match Template panel Sep 4, 2025
Copilot AI requested a review from bHimes September 4, 2025 11:32
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.

volume asset not there

2 participants