Skip to content

Commit a483ef8

Browse files
committed
correctly use reference for context in QgsReadWriteContextCategoryPopper
1 parent 3c78fb5 commit a483ef8

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

python/core/qgsreadwritecontext.sip.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ This would happen when it gets out of scope.
116116
#include "qgsreadwritecontext.h"
117117
%End
118118
public:
119-
QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context );
119+
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context );
120120
%Docstring
121121
Creates a popper
122122
%End

src/core/qgsreadwritecontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory( const QStr
4141
if ( !details.isEmpty() )
4242
message.append( QString( " :: %1" ).arg( details ) );
4343
mCategories.push_back( message );
44-
return QgsReadWriteContextCategoryPopper( this );
44+
return QgsReadWriteContextCategoryPopper( *this );
4545
}
4646

4747
void QgsReadWriteContext::leaveCategory()

src/core/qgsreadwritecontext.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,10 @@ class CORE_EXPORT QgsReadWriteContextCategoryPopper
124124
{
125125
public:
126126
//! Creates a popper
127-
QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context ) : mContext( context ) {}
128-
~QgsReadWriteContextCategoryPopper()
129-
{
130-
if ( mContext )
131-
mContext->leaveCategory();
132-
}
127+
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context ) : mContext( context ) {}
128+
~QgsReadWriteContextCategoryPopper() {mContext.leaveCategory();}
133129
private:
134-
QgsReadWriteContext *mContext;
130+
QgsReadWriteContext &mContext;
135131
};
136132

137133
#endif // QGSREADWRITECONTEXT_H

0 commit comments

Comments
 (0)