Commit cebd38891a4e905a71cb8aaa105e878bbeb1917b

Authored by Josh Klontz
1 parent 106dc0eb

avoid infinite loops when attempting to automatically locate the SDK

Showing 1 changed file with 3 additions and 0 deletions
openbr/openbr_plugin.cpp
... ... @@ -1245,6 +1245,7 @@ void br::Context::initialize(int &argc, char *argv[], QString sdkPath, bool useG
1245 1245 if (sdkPath.isEmpty()) {
1246 1246 QStringList checkPaths; checkPaths << QCoreApplication::applicationDirPath() << QDir::currentPath();
1247 1247 checkPaths << QString(getenv("PATH")).split(sep, QString::SkipEmptyParts);
  1248 + QSet<QString> checkedPaths; // Avoid infinite loops from symlinks
1248 1249  
1249 1250 bool foundSDK = false;
1250 1251 foreach (const QString &path, checkPaths) {
... ... @@ -1252,6 +1253,8 @@ void br::Context::initialize(int &amp;argc, char *argv[], QString sdkPath, bool useG
1252 1253 QDir dir(path);
1253 1254 do {
1254 1255 sdkPath = dir.absolutePath();
  1256 + if (checkedPaths.contains(sdkPath)) break;
  1257 + else checkedPaths.insert(sdkPath);
1255 1258 foundSDK = checkSDKPath(sdkPath);
1256 1259 dir.cdUp();
1257 1260 } while (!foundSDK && !dir.isRoot());
... ...