Skip to content

Commit

Permalink
Add a warning about the usage of setInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Sep 16, 2020
1 parent a782420 commit cbb0cb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions python/core/auto_generated/qgsproject.sip.in
Expand Up @@ -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`

Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsproject.h
Expand Up @@ -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
*/
Expand Down

0 comments on commit cbb0cb3

Please sign in to comment.