Skip to content

Commit

Permalink
Don't crash when QgsVectorLayer::setDataSource is called
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 22, 2015
1 parent 436350a commit 9fc7593
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1371,15 +1371,12 @@ void QgsVectorLayer::setDataSource( QString dataSource, QString baseName, QStrin

bool QgsVectorLayer::setDataProvider( QString const & provider )
{
// XXX should I check for and possibly delete any pre-existing providers?
// XXX How often will that scenario occur?
Q_ASSERT( !mDataProvider );

mProviderKey = provider; // XXX is this necessary? Usually already set
// XXX when execution gets here.

//XXX - This was a dynamic cast but that kills the Windows
// version big-time with an abnormal termination error
delete mDataProvider;
mDataProvider =
( QgsVectorDataProvider* )( QgsProviderRegistry::instance()->provider( provider, mDataSource ) );

Expand Down

0 comments on commit 9fc7593

Please sign in to comment.