Check if canvas exists before accessing it #140
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Neuropixels 2.0e Headstage
in Port A, and then connect to the hardware and set the appropriate calibration file.Replicate the issue:
A temporary fix:
Active
parameter to be true (e.g.,<TAB Active="1"/>
), then load the GUI again. This should allow the plugin to properly loadFixes #139