File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ void QgsSvgSelectorLoader::run()
51
51
{
52
52
mCancelled = false ;
53
53
mQueuedSvgs .clear ();
54
+ mTraversedPaths .clear ();
54
55
55
56
// start with a small initial timeout (ms)
56
57
mTimerThreshold = 10 ;
@@ -92,9 +93,17 @@ void QgsSvgSelectorLoader::loadPath( const QString& path )
92
93
}
93
94
else
94
95
{
96
+ QDir dir ( path );
97
+
98
+ // guard against circular symbolic links
99
+ QString canonicalPath = dir.canonicalPath ();
100
+ if ( mTraversedPaths .contains ( canonicalPath ) )
101
+ return ;
102
+
103
+ mTraversedPaths .insert ( canonicalPath );
104
+
95
105
loadImages ( path );
96
106
97
- QDir dir ( path );
98
107
Q_FOREACH ( const QString& item, dir.entryList ( QDir::Dirs | QDir::NoDotAndDotDot ) )
99
108
{
100
109
if ( mCancelled )
@@ -159,6 +168,7 @@ QgsSvgGroupLoader::~QgsSvgGroupLoader()
159
168
void QgsSvgGroupLoader::run ()
160
169
{
161
170
mCancelled = false ;
171
+ mTraversedPaths .clear ();
162
172
163
173
while ( !mCancelled && !mParentPaths .isEmpty () )
164
174
{
@@ -177,6 +187,13 @@ void QgsSvgGroupLoader::loadGroup( const QString& parentPath )
177
187
{
178
188
QDir parentDir ( parentPath );
179
189
190
+ // guard against circular symbolic links
191
+ QString canonicalPath = parentDir.canonicalPath ();
192
+ if ( mTraversedPaths .contains ( canonicalPath ) )
193
+ return ;
194
+
195
+ mTraversedPaths .insert ( canonicalPath );
196
+
180
197
Q_FOREACH ( const QString& item, parentDir.entryList ( QDir::Dirs | QDir::NoDotAndDotDot ) )
181
198
{
182
199
if ( mCancelled )
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ class GUI_EXPORT QgsSvgSelectorLoader : public QThread
91
91
92
92
QElapsedTimer mTimer ;
93
93
int mTimerThreshold ;
94
+ QSet< QString > mTraversedPaths ;
94
95
95
96
void loadPath ( const QString& path );
96
97
void loadImages ( const QString& path );
@@ -145,6 +146,7 @@ class GUI_EXPORT QgsSvgGroupLoader : public QThread
145
146
146
147
QStringList mParentPaths ;
147
148
bool mCancelled ;
149
+ QSet< QString > mTraversedPaths ;
148
150
149
151
void loadGroup ( const QString& parentPath );
150
152
You can’t perform that action at this time.
0 commit comments