Bug report #17388

QGIS crashes on featureCount()

Added by Nikolay Lebedev almost 3 years ago. Updated almost 3 years ago.

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

Description

Easy to reproduce: Start QGIS, open up python console and type in:

uri = QgsDataSourceURI()
uri.setConnection('localhost', '5432', 'test', 'postgres', '',QgsDataSourceURI.SSLdisable)
uri.setDataSource('schema', 'table' , "geom", '' , "gid")
layer = QgsVectorLayer(uri.uri(False), 'table', "postgres")
layer.featureCount()

Click Cancel when asked for DB credentials and enter to execute layer.featureCount() call.
Boom - QGIS crashes.
Tested on Win and MacOS on 2.18.14 and 2.18.3

Associated revisions

Revision fe565310
Added by Alessandro Pasotti almost 3 years ago

[bugfix][postgresql] Fix crashes on featureCount()

Fixes #17388

Needs backporting

Revision 269038ef
Added by Alessandro Pasotti almost 3 years ago

[bugfix][postgresql] Fix crashes on featureCount()

Fixes #17388

Backported from master fe5653101a57

History

#1 Updated by Giovanni Manghi almost 3 years ago

  • Priority changed from Normal to High

#2 Updated by Alessandro Pasotti almost 3 years ago

  • Assignee set to Alessandro Pasotti

#3 Updated by Alessandro Pasotti almost 3 years ago

This is 2.18 only, correct?

#4 Updated by Nikolay Lebedev almost 3 years ago

Haven't tested it on master yet.

#5 Updated by Ivan Fomin almost 3 years ago

LTR 2.14.20 is also affected

#6 Updated by Giovanni Manghi almost 3 years ago

Ivan Fomin wrote:

LTR 2.14.20 is also affected

2,18 is the new LTR, 2.14 will not get anymore any fix.

#7 Updated by Anonymous almost 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#8 Updated by Alessandro Pasotti almost 3 years ago

  • Affected QGIS version changed from 2.18.14 to master
  • Resolution set to fixed/implemented

Fixed in master: requires backport to 2.18

#9 Updated by Alessandro Pasotti almost 3 years ago

Backported to 2.18

Also available in: Atom PDF