Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple property handler bugs #37186

Merged
merged 8 commits into from May 7, 2024

Conversation

jhaigh0
Copy link
Contributor

@jhaigh0 jhaigh0 commented Apr 18, 2024

Description of work

Initially this work was just to fix #37129, but I also found a bug where all the remaining "Fix" properties would be removed when removing a function from the same composite function.

Summary of work

  • To fix the original issue, the parameter index needed to be retrieved from the top level composite function so the long prefix (f0.f0.f0) could be parsed properly.
  • To fix the issue with removing the Fix sub properties, a check has been added to renameChildren to see if the parameter is fixed.
  • I noticed that when adding the first function to a convolution, it sets all parameters to be fixed. When this gets initialised in the property handler, I've changed it to use the fix function so it is all more consistent
  • I've also reduced some code reuse by changing fix to call addTie which now checks if the tie is static (aka a fix).

Fixes #37129

renameChildren definitely still contains a problem or two. I don't think it copes well if you had a bunch of nested composite function and wanted to tie across different levels, but this isn't a regression, so I will try and fix these in a later pr.

To test:

  • Follow the instructions from the issue
  • Clear the model
  • Add two Gaussians
  • Right click to fix the height of one of the Gaussians
  • Remove the other Gaussian, the fix property should remain in place.

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

The underlying function does not add a tie to its list of ties if the expression is static.
The property handler does not follow this behaviour and adds static ties to m_ties.
Therefore, simply checking that getTie returns a nullpointer is not enough to confirm that a tie has been removed.
@jhaigh0 jhaigh0 added ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Reported By User Issues that were found or highlighted by a user/scientist labels Apr 18, 2024
@jhaigh0 jhaigh0 added this to the Release 6.10 milestone Apr 18, 2024
@robertapplin robertapplin self-assigned this May 3, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Code looks good and the original crash no longer happens. I just had two questions, then happy to approve

qt/widgets/common/src/PropertyHandler.cpp Show resolved Hide resolved
qt/widgets/common/src/PropertyHandler.cpp Show resolved Hide resolved
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

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

Thanks for confirming - in that case happy to approve!

@SilkeSchomann SilkeSchomann merged commit fb34fb5 into main May 7, 2024
10 checks passed
@SilkeSchomann SilkeSchomann deleted the 37129_parse_name_in_nested_function_bug branch May 7, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS Reported By User Issues that were found or highlighted by a user/scientist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when removing a function from a composite function inside a convolution function
3 participants