qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.65k stars 3.01k forks source link

QgsProcessingAlgorithm: add variants of addParameter() and addOutput() that accept a std::unique_ptr #59512

Open rouault opened 2 days ago

rouault commented 2 days ago

If we had those 2 new variants and used them, we would have immediately detected the issue fixed by https://github.com/qgis/QGIS/pull/59511, because the std::move() would have zeroed the smart pointer causing an immediate null-ptr derefrence when later used.

There is no good reason in 2024 to use explicit new and delete :-)

github-actions[bot] commented 2 days ago

🪟 Windows builds

Download Windows builds of this PR for testing. Debug symbols for this build are available here. (Built from commit 5a1ebdb1a541ef20346f06d20a7f2be35f6dbac7)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing. (Built from commit 5a1ebdb1a541ef20346f06d20a7f2be35f6dbac7)

nyalldawson commented 2 days ago

@rouault I've reached out to the PyQt list to see if we can get https://github.com/qgis/QGIS/pull/59513 in shape. If so, then we could just switch the original methods over to the unique_ptr variants and avoid the double-API...