Skip to content

Conversation

bparks13
Copy link
Member

@bparks13 bparks13 commented Aug 4, 2025

This PR fixes an issue that can occur if a canvas is popped out into a window, but then the window and the tab are both closed. In this instance, the canvas could be a nullptr while the parameters are being loaded leading to a hard crash. Now, there are checks in place to avoid this, as well as error messages indicating what the issue might be.

A secondary issue came about while fixing the initial issue; if the canvas is a nullptr and it is just skipped, then the XML file will not be loaded correctly. Each device tab is responsible for loading its own data from the file, but if the canvas does not exist when the editor parameters are loaded then the tabs are not added to the canvas. Now, right before the editor parameters are loaded, the canvas is properly instantiated if it did not exist.

For testing

Setup:

  • In the main branch, open up the GUI and set some parameters, such as choosing Neuropixels 2.0e Headstage in Port A, and then connect to the hardware and set the appropriate calibration file.
  • Acquire some data to ensure that everything works
  • Close the ONIX Source canvas by ensuring that there is no Tab or Window open
  • Close the GUI

Replicate the issue:

  • Open the GUI again, load the appropriate file
  • The GUI should crash, as it is trying to access the canvas that does not exist

A temporary fix:

  • In the XML file, under SIGNALCHAIN --> PROCESSOR [ONIX Source] --> EDITOR --> TAB [or WINDOW], modify the Active parameter to be true (e.g., <TAB Active="1"/>), then load the GUI again. This should allow the plugin to properly load

Fixes #139

@bparks13 bparks13 added this to the 0.1.1 milestone Aug 4, 2025
@bparks13 bparks13 requested a review from jonnew August 4, 2025 19:23
@bparks13 bparks13 self-assigned this Aug 4, 2025
@jonnew jonnew requested review from anjaldoshi and removed request for jonnew August 8, 2025 13:30
@bparks13 bparks13 modified the milestones: 0.2.1, 0.2.0 Aug 8, 2025
Copy link
Contributor

@anjaldoshi anjaldoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, no more crashes!

- Give a warning to the user if the canvas does not exist, as this will heavily impact functionality
@bparks13 bparks13 merged commit 7b181e4 into main Aug 11, 2025
3 checks passed
@bparks13 bparks13 deleted the issue-139 branch August 11, 2025 13:57
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.

Plugin can crash during loading if canvas is not created before loading custom parameters
2 participants