Skip to content

Commit d5bfc82

Browse files
nirvnnyalldawson
authored andcommitted
[delimitertext] fix watcher check ignored and harmful watcher created for iterator
(fixes #15558) (cherry-picked from b3e3108)
1 parent ed75016 commit d5bfc82

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
@@ -501,8 +501,16 @@ QgsDelimitedTextFeatureSource::QgsDelimitedTextFeatureSource( const QgsDelimited
501501
, mXyDms( p->mXyDms )
502502
, attributeColumns( p->attributeColumns )
503503
{
504+
QUrl url = p->mFile->url();
505+
506+
// make sure watcher not created when using iterator (e.g. for rendering, see issue #15558)
507+
if ( url.hasQueryItem( "watchFile" ) )
508+
{
509+
url.removeQueryItem( "watchFile" );
510+
}
511+
504512
mFile = new QgsDelimitedTextFile();
505-
mFile->setFromUrl( p->mFile->url() );
513+
mFile->setFromUrl( url );
506514

507515
mExpressionContext << QgsExpressionContextUtils::globalScope()
508516
<< 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)