Skip to content
Permalink
Browse files

Better comment to explain why the ref needs to be incremented

  • Loading branch information
elpaso committed Jun 4, 2018
1 parent 3aa630c commit 0430a8d59c1d6f6097d5b5a3e697198e97b16030
Showing with 4 additions and 2 deletions.
  1. +2 −1 python/core/auto_generated/qgsprovidermetadata.sip.in
  2. +2 −1 src/core/qgsprovidermetadata.h
@@ -45,7 +45,8 @@ no library is involved.
%End
%MethodCode

// Make sure the callable doesn't get garbage collected
// Make sure the callable doesn't get garbage collected, this is needed because refcount for a2 is 0
// and the creation function pointer is passed to the metadata and it needs to be kept in memory.
Py_INCREF( a2 );

Py_BEGIN_ALLOW_THREADS
@@ -66,7 +66,8 @@ class CORE_EXPORT QgsProviderMetadata
QgsProviderMetadata( const QString &key, const QString &description, SIP_PYCALLABLE / AllowNone / );
% MethodCode

// Make sure the callable doesn't get garbage collected
// Make sure the callable doesn't get garbage collected, this is needed because refcount for a2 is 0
// and the creation function pointer is passed to the metadata and it needs to be kept in memory.
Py_INCREF( a2 );

Py_BEGIN_ALLOW_THREADS

0 comments on commit 0430a8d

Please sign in to comment.
You can’t perform that action at this time.