From cbb0cb3f1c43a6dca6504960db6bf55dda874381 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Wed, 16 Sep 2020 10:33:11 +0200 Subject: [PATCH] Add a warning about the usage of setInstance --- python/core/auto_generated/qgsproject.sip.in | 8 ++++++-- src/core/qgsproject.h | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/python/core/auto_generated/qgsproject.sip.in b/python/core/auto_generated/qgsproject.sip.in index b21c203c692..115d3990a3a 100644 --- a/python/core/auto_generated/qgsproject.sip.in +++ b/python/core/auto_generated/qgsproject.sip.in @@ -71,11 +71,15 @@ Returns the QgsProject singleton instance static void setInstance( QgsProject *project ); %Docstring -Set the current project instance to ``project`` +Set the current project singleton instance to ``project`` .. note:: - this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request + this method is provided mainly for the server, which caches the projects and (potentially) needs to switch the current instance on every request. + +.. warning:: + + calling this method can have serious, unintended consequences, including instability, data loss and undefined behaviour. Use with EXTREME caution! .. seealso:: :py:func:`instance` diff --git a/src/core/qgsproject.h b/src/core/qgsproject.h index 93151bd6ac1..5d111d2f211 100644 --- a/src/core/qgsproject.h +++ b/src/core/qgsproject.h @@ -166,9 +166,10 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera static QgsProject *instance(); /** - * Set the current project instance to \a project + * Set the current project singleton instance to \a project * - * \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request + * \note this method is provided mainly for the server, which caches the projects and (potentially) needs to switch the current instance on every request. + * \warning calling this method can have serious, unintended consequences, including instability, data loss and undefined behaviour. Use with EXTREME caution! * \see instance() * \since QGIS 3.10.11 */