Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/kernel/qhostinfo.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    169169        QHostInfo hostInfo(id);
    170170        hostInfo.setError(QHostInfo::HostNotFound);
    171         hostInfo.setErrorString(QObject::tr("No host name given"));
     171        hostInfo.setErrorString(Q"No host name given"));
    172172        QScopedPointer<QHostInfoResult> result(new QHostInfoResult);
    173173        QObject::connect(result.data(), SIGNAL(resultsReady(QHostInfo)),
     
    244244#endif
    245245
    246     return QHostInfoAgent::fromName(name);
     246    QHostInfo hostInfo = QHostInfoAgent::fromName(name);
     247    QHostInfoLookupManager *manager = theHostInfoLookupManager();
     248    manager->cache.put(name, hostInfo);
     249    return hostInfo;
    247250}
    248251
     
    468471    resultEmitter.emitResultsReady(hostInfo);
    469472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
    470488    manager->lookupFinished(this);
    471489
     
    485503
    486504    // don't qDeleteAll currentLookups, the QThreadPool has ownership
    487     qDeleteAll(postponedLookups);
    488     qDeleteAll(scheduledLookups);
    489     qDeleteAll(finishedLookups);
     505    clear();
     506}
     507
     508void QHostInfoLookupManager::clear()
     509{
     510    {
     511        QMutexLocker locker(&mutex);
     512        qDeleteAll(postponedLookups);
     513        qDeleteAll(scheduledLookups);
     514        qDeleteAll(finishedLookups);
     515        postponedLookups.clear();
     516        scheduledLookups.clear();
     517        finishedLookups.clear();
     518    }
     519
     520    threadPool.waitForDone();
     521    cache.clear();
    490522}
    491523
     
    579611
    580612    QMutexLocker locker(&this->mutex);
     613
     614
     615
     616
     617
     618
     619
     620
     621
     622
     623
     624
     625
     626
     627
     628
     629
    581630    if (!abortedLookups.contains(id))
    582631        abortedLookups.append(id);
     
    605654}
    606655
    607 // This function returns immediatly when we had a result in the cache, else it will later emit a signal
     656// This function returns immediatly when we had a result in the cache, else it will later emit a signal
    608657QHostInfo qt_qhostinfo_lookup(const QString &name, QObject *receiver, const char *member, bool *valid, int *id)
    609658{
     
    631680    QHostInfoLookupManager* manager = theHostInfoLookupManager();
    632681    if (manager) {
    633         manager->cache.clear();
     682        manager->clear();
    634683    }
    635684}
Note: See TracChangeset for help on using the changeset viewer.