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

ENH: Remove warning message when nullptr is used as vtkObject pointer event data #944

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

lassoan
Copy link
Member

@lassoan lassoan commented Dec 8, 2020

ctkVTKConnection logged a warning message each time an event was received that vtkObject* as event data and the pointer was nullptr.

Always treating nullptr value as an error is too limiting, because it is often useful that an additional pointer can be supplied but not mandatory.

This change removes the warning message from ctkVTKConnection and makes it the event receiver's responsibility to log warning/error if in that particular case nullptr is not expected.
Since ctkVTKConnection just logged a warning message but already left nullptr values through, it is guaranteed that change does not alter any existing software behavior
(other than not displaying the warning).

This change is useful in Slicer because DisplayModified events typically contain the display node pointer as eventdata but if multiple DisplayModified events are lumped together
(due to batch update with Start/EndModify) then there is no display node that could be attached to the event.

… event data

ctkVTKConnection logged a warning message each time an event was received that vtkObject* as event data and the pointer was nullptr.

Always treating nullptr value as an error is too limiting, because it is often useful that an additional pointer can be supplied but not mandatory.

This change removes the warning message from ctkVTKConnection and makes it the event receiver's responsibility to log warning/error if in that particular case nullptr is not expected.
Since ctkVTKConnection just logged a warning message but already left nullptr values through, it is guaranteed that change does not alter any existing software behavior
(other than not displaying the warning).

This change is useful in Slicer because DisplayModified events typically contain the display node pointer as eventdata but if multiple DisplayModified events are lumped together
(due to batch update with Start/EndModify) then there is no display node that could be attached to the event.
@lassoan lassoan requested a review from jcfr December 8, 2020 20:46
@pieper pieper merged commit ac0cadf into commontk:master Dec 8, 2020
@lassoan
Copy link
Member Author

lassoan commented Dec 8, 2020

Thanks @pieper!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants