Bug report #9319

copy of QgsExpression causes segfault

Added by Vincent Mora over 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:High
Assignee:Vincent Mora
Category:Expressions
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:17926

Description

The default copy and assigment operator of QgsExpression causes segfault (multiple delete) if used.

Since the copy and assigment operator are not used anywhere I just made the class non-copyable (so the future developers won't get caught like I was)

The pull request is there: https://github.com/qgis/QGIS/pull/1075

Associated revisions

Revision 37ba8e41
Added by Martin Dobias over 9 years ago

Fix #9319 (copy of QgsExpression crashes)

Disabled the copy constructor for now (later we may introduce implicit sharing)

History

#1 Updated by Giovanni Manghi about 10 years ago

  • Priority changed from Normal to High

#2 Updated by Jürgen Fischer about 10 years ago

  • Status changed from Open to Closed

pull request merged in 3568fe761

#3 Updated by Matthias Kuhn over 9 years ago

  • Status changed from Closed to Reopened

I can still copy and I get the same crash.

QgsExpression* exp = new QgsExpression( "1" );
QgsExpression* exp2 = new QgsExpression( exp );

delete ( exp );
delete ( exp2 );

Proposal: make this class implicitly shared.

#4 Updated by Martin Dobias over 9 years ago

  • Status changed from Reopened to Closed

Also available in: Atom PDF