Skip to content

Commit 3dbf97f

Browse files
nirvnnyalldawson
authored andcommittedSep 13, 2016
[delimitertext] fix watcher check ignored and harmful watcher created for iterator
(fixes #15558) (cherry-picked from b3e3108)
1 parent e32bb54 commit 3dbf97f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed
 

‎src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,16 @@ QgsDelimitedTextFeatureSource::QgsDelimitedTextFeatureSource( const QgsDelimited
502502
, mXyDms( p->mXyDms )
503503
, attributeColumns( p->attributeColumns )
504504
{
505+
QUrl url = p->mFile->url();
506+
507+
// make sure watcher not created when using iterator (e.g. for rendering, see issue #15558)
508+
if ( url.hasQueryItem( "watchFile" ) )
509+
{
510+
url.removeQueryItem( "watchFile" );
511+
}
512+
505513
mFile = new QgsDelimitedTextFile();
506-
mFile->setFromUrl( p->mFile->url() );
514+
mFile->setFromUrl( url );
507515

508516
mExpressionContext << QgsExpressionContextUtils::globalScope()
509517
<< QgsExpressionContextUtils::projectScope();

‎src/providers/delimitedtext/qgsdelimitedtextfile.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QgsDelimitedTextFile::QgsDelimitedTextFile( const QString& url )
3535
, mEncoding( "UTF-8" )
3636
, mFile( nullptr )
3737
, mStream( nullptr )
38-
, mUseWatcher( true )
38+
, mUseWatcher( false )
3939
, mWatcher( nullptr )
4040
, mDefinitionValid( false )
4141
, mUseHeader( true )
@@ -158,9 +158,9 @@ bool QgsDelimitedTextFile::setFromUrl( const QUrl &url )
158158
}
159159

160160
//
161-
if ( url.hasQueryItem( "useWatcher" ) )
161+
if ( url.hasQueryItem( "watchFile" ) )
162162
{
163-
mUseWatcher = ! url.queryItemValue( "useWatcher" ).toUpper().startsWith( 'N' );
163+
mUseWatcher = url.queryItemValue( "watchFile" ).toUpper().startsWith( 'Y' );
164164
}
165165

166166
// The default type is csv, to be consistent with the
@@ -269,9 +269,9 @@ QUrl QgsDelimitedTextFile::url()
269269
url.addQueryItem( "encoding", mEncoding );
270270
}
271271

272-
if ( !mUseWatcher )
272+
if ( mUseWatcher )
273273
{
274-
url.addQueryItem( "useWatcher", "no" );
274+
url.addQueryItem( "watchFile", "yes" );
275275
}
276276

277277
url.addQueryItem( "type", type() );

0 commit comments

Comments
 (0)
Please sign in to comment.