-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add some thread safety to Qgs3DMapSettings usage #58398
Conversation
@wonder-sk @ptitjano @benoitdm-oslandia as previously discussed. |
3326d91
to
02d5ce4
Compare
@nyalldawson few questions about this:
|
Thanks for the feedback!
I lean toward keeping it minimal, and adding the properties only when we have a need to do so. (None of this is exposed to Python yet, so there's no disadvantage I can see in adding properties on demand when we need them in c++ code).
Makes sense to me. I'll rework this and condense the new class into Qgs3DRenderContext, and remove the Qgs3DMapSettings property from Qgs3DRenderContext.
I was originally going for a "use the snapshot wherever we can get away with it" approach, but I like the consistency of the Qgs3DMapSceneEntity change you describe better 👍 |
@nyalldawson I was wondering if this new class must be read-only ie. without any setters. It disturbs me a bit a have an object acting as a clone of the main |
Create a small, cheap to copy (non-qobject) class Qgs3DMapSettingsSnapshot which is designed to store just cheap properties of Qgs3DMapSettings. Then use this object wherever possible to avoid accessing the (non-thread safe) Qgs3DMapSettings object for retrieval of simple map properties (eg crs, extent, ...) Refs qgis/QGIS-Enhancement-Proposals#301
c51cc93
to
240cdde
Compare
@wonder-sk ok, all done as discussed
Indeed they were only used to initially set the properties from the map settings. I've removed all the setters now, and just set the members directly when first constructing Qgs3DRenderContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the improvements!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 well done - nice cleanup!
Unrelated clang tidy failure |
Create a small, cheap to copy (non-qobject) class
Qgs3DMapSettingsSnapshot which is designed to store just cheap properties of Qgs3DMapSettings. Then use this object wherever possible to avoid accessing the (non-thread safe) Qgs3DMapSettings object for retrieval of simple map properties (eg crs, extent, ...)
Refs qgis/QGIS-Enhancement-Proposals#301