-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Don't keep pointer to QgsPointCloudLayer in QgsPointCloudLayerRenderer and QgsPointCloudLayerProfileGenerator #60086
Conversation
da23ec8
to
5e92e01
Compare
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Tests failed for Qt 5One or more tests failed using the build from commit a3866f4 classified_render_edit_1 (testModifyAttributeValue)classified_render_edit_1Test failed at testModifyAttributeValue at tests/src/core/testqgspointcloudediting.cpp:193 Rendered image did not match tests/testdata/control_images/pointcloud_editing/expected_classified_render_edit_1/expected_classified_render_edit_1.png (found 490 pixels different) The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
Tests failed for Qt 6One or more tests failed using the build from commit a3866f4 classified_render_edit_1 (testModifyAttributeValue)classified_render_edit_1Test failed at testModifyAttributeValue at tests/src/core/testqgspointcloudediting.cpp:193 Rendered image did not match tests/testdata/control_images/pointcloud_editing/expected_classified_render_edit_1/expected_classified_render_edit_1.png (found 490 pixels different) The full test report (included comparison of rendered vs expected images) can be found here. Further documentation on the QGIS test infrastructure can be found in the Developer's Guide. |
5e92e01
to
5777b8e
Compare
Same change needs to be applied to the profile renderer too. |
const QVector< QgsPointCloudSubIndex > mSubIndexes; | ||
std::optional<QgsPointCloudIndex> mOverviewIndex; |
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.
Just curious, is there a benefit of using std::optional
instead of just a QgsPointCloudIndex()
/ QgsPointCloudIndex( nullptr )
, which evaluates as false
?
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.
Good catch. There isn't, I just personally default to using std::optional
when a member can be explicitly left out, and don't much like putting nullptr
in smart pointers.
It is redundant (and probably inconsistent with the rest of the codebase), so if you think it's better, I'll change it to the bare index object.
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.
That's a nice habit I guess!
It would be ever slightly more readable without it, as optional
is barely used in the codebase, but I don't have a strong opinion :)
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.
I'd personally love to see optional used more often -- it's quite an elegant solution to some tricky API considerations... just so long as we don't need to worry about exposure to Python 🤣
Do you mean |
Yes, I mean We can ignore the |
Thanks, I see it now. I've fixed this method as well and made the |
After the last 3 commits there should be no place left that calls this from a worker thread.
467bfd6
to
a3866f4
Compare
Nice! |
Thanks, I didn't notice that. The test now passes on my machine.
Done. |
Description
This is a quick change that refactors a small problem in
QgsPointCloudLayerRenderer
. Previouslyrender()
used a savedQgsPointCloudLayer
object (and called methods on it andQgsPointCloudDataProvider
, generating warnings), but that object is not thread safe. Instead we now get everything we need up-front and only keep a refcounted pointer to the thread-safe layer index.EDIT: I've also made a similar change to
QgsPointCloudLayerProfileGenerator
, since it was pointed out it had the same issue.