Skip to content

Commit

Permalink
correctly use reference for context in QgsReadWriteContextCategoryPopper
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 1, 2018
1 parent 3c78fb5 commit a483ef8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsreadwritecontext.sip.in
Expand Up @@ -116,7 +116,7 @@ This would happen when it gets out of scope.
#include "qgsreadwritecontext.h"
%End
public:
QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context );
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context );
%Docstring
Creates a popper
%End
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsreadwritecontext.cpp
Expand Up @@ -41,7 +41,7 @@ QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory( const QStr
if ( !details.isEmpty() )
message.append( QString( " :: %1" ).arg( details ) );
mCategories.push_back( message );
return QgsReadWriteContextCategoryPopper( this );
return QgsReadWriteContextCategoryPopper( *this );
}

void QgsReadWriteContext::leaveCategory()
Expand Down
10 changes: 3 additions & 7 deletions src/core/qgsreadwritecontext.h
Expand Up @@ -124,14 +124,10 @@ class CORE_EXPORT QgsReadWriteContextCategoryPopper
{
public:
//! Creates a popper
QgsReadWriteContextCategoryPopper( QgsReadWriteContext *context ) : mContext( context ) {}
~QgsReadWriteContextCategoryPopper()
{
if ( mContext )
mContext->leaveCategory();
}
QgsReadWriteContextCategoryPopper( QgsReadWriteContext &context ) : mContext( context ) {}
~QgsReadWriteContextCategoryPopper() {mContext.leaveCategory();}
private:
QgsReadWriteContext *mContext;
QgsReadWriteContext &mContext;
};

#endif // QGSREADWRITECONTEXT_H

0 comments on commit a483ef8

Please sign in to comment.