Fix removing watching for file modifications #965
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.
Description
This depends on (and contains the commits) for pull request Ultimaker/Urandium#964.
If the file is no longer part of the scene graph no longer watch it
for file modifications. This had been triggered from MeshData when it
was deleted, but _application was no longer populated so it was not
being called.
_application could be replaced by querying the current instance.
The problem with calling removeWatchedFile from MeshData
__del__
, isCura 5.8.1 is creating three MeshData objects with the file name
populated, when the file is loaded, two are deleted, the last stays
around. If it were to call from the first two objects being deleted,
it would remove the watch even though it is loaded as part of the
scene. Further I'm seeing that the last object isn't getting deleted,
even when it is removed from the scene graph. I don't know if this is
a memory leak or if there would still be an issue with undo/redo.
Instead listen for the scene graph meshDataChanged signal, collect the
files in the scene graph and add or remove based on that list. This
does not listen to sceneChanged signal as that includes transform
changes, which won't change the set of files listened for.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: