Changeset 1152 for trunk/src


Ignore:
Timestamp:
Jun 17, 2013, 11:11:39 PM (12 years ago)
Author:
Dmitry A. Kuminov
Message:

core: OS/2: Don't cache plugin load attempts failed due to missing dependencies.

This would hide the plugin from Qt forever, even if all dependencies were later satisfied.
See #289 for details.

Location:
trunk/src/corelib/plugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/plugin/qlibrary.cpp

    r1151 r1152  
    582582    QByteArray key;
    583583    bool success = false;
     584    bool temporary_failure = false;
    584585
    585586#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
     
    662663                if (fileinfo.exists())
    663664#  endif
    664                 temporary_load =  load_sys();
     665#  if defined(Q_OS_OS2)
     666                APIRET rc = load_sys_rc();
     667                temporary_load = rc == NO_ERROR;
     668                temporary_failure = rc == ERROR_FILE_NOT_FOUND;
     669#  else
     670                temporary_load = load_sys();
     671#  endif
    665672#endif
    666673            }
     
    698705                qt_version = 0;
    699706                key = "unknown";
    700                 if (temporary_load)
    701                     unload_sys();
    702707            } else {
    703708                success = true;
     
    709714                    hTempModule = 0;
    710715                }
    711 
    712716            }
     717#else
     718            if (temporary_load)
     719                unload_sys();
    713720#endif
    714721        }
     
    718725
    719726#ifndef QT_NO_SETTINGS
    720         QStringList queried;
    721         queried << QString::number(qt_version,16)
    722                 << QString::number((int)debug)
    723                 << QLatin1String(key)
    724                 << lastModified;
    725         settings->setValue(regkey, queried);
     727        // Loading may fail due to a temporary failure like missing dependencies.
     728        // Do not caches such failures since in this case the plugin will be
     729        // ignored by Qt forever - even when these failures are fixed later.
     730        if (!temporary_failure) {
     731            QStringList queried;
     732            queried << QString::number(qt_version,16)
     733                    << QString::number((int)debug)
     734                    << QLatin1String(key)
     735                    << lastModified;
     736            settings->setValue(regkey, queried);
     737        }
    726738#endif
    727739    }
     
    734746                errorString = QLibrary::tr("The file '%1' is not a valid Qt plugin.").arg(fileName);
    735747        }
     748        pluginState = temporary_failure ? MightBeAPlugin : IsNotAPlugin;
    736749        return false;
    737750    }
  • trunk/src/corelib/plugin/qlibrary_os2.cpp

    r1111 r1152  
    9696}
    9797
    98 bool QLibraryPrivate::load_sys()
     98APIRET QLibraryPrivate::load_sys_rc()
    9999{
    100100    pHnd = 0;
     
    131131            errorString += QLibrary::tr(" (failed module: %1)")
    132132                .arg(QFile::decodeName(errModule));
    133         return false;
     133        pHnd = 0;
     134        return rc;
    134135    }
    135136
     
    140141    qualifiedFileName = QDir::fromNativeSeparators(QFile::decodeName(QByteArray(errModule)));
    141142
    142     return true;
     143    return NO_ERROR;
    143144}
    144145
  • trunk/src/corelib/plugin/qlibrary_p.h

    r846 r1152  
    109109    ~QLibraryPrivate();
    110110
     111#if defined(Q_OS_OS2)
     112    APIRET load_sys_rc();
     113    bool load_sys() { return load_sys_rc() == NO_ERROR; }
     114#else
    111115    bool load_sys();
     116#endif
    112117    bool unload_sys();
    113118    void *resolve_sys(const char *);
Note: See TracChangeset for help on using the changeset viewer.