Don't crash when QgsVectorLayer::setDataSource is called

This commit is contained in:
Nyall Dawson 2015-06-22 19:25:37 +10:00
parent 436350a4e3
commit 9fc759308f

View File

@ -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 ) );