Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/dbus/qdbusintegrator.cpp

    r651 r769  
    524524
    525525    QDBusMessage amsg = QDBusMessagePrivate::fromDBusMessage(message);
    526     qDBusDebug() << d << "got message:" << amsg;
     526    qDBusDebug() << d << "got message:" << amsg;
    527527
    528528    return d->handleMessage(amsg) ?
     
    16611661
    16621662    QString busService = QLatin1String(DBUS_SERVICE_DBUS);
    1663     WatchedServicesHash::mapped_type &bus = watchedServices[busService];
    1664     bus.refcount = 1;
    1665     bus.owner = getNameOwnerNoCache(busService);
    16661663    connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
    16671664                  this, SLOT(registerService(QString)));
     
    16911688{
    16921689    Q_ASSERT(pcall->pending);
    1693     QDBusDispatchLocker locker(PendingCallBlockAction, this);
    1694     q_dbus_pending_call_block(pcall->pending);
    1695     // QDBusConnectionPrivate::processFinishedCall() is called automatically
     1690    Q_ASSERT(!pcall->autoDelete);
     1691    //Q_ASSERT(pcall->mutex.isLocked()); // there's no such function
     1692
     1693    if (pcall->waitingForFinished) {
     1694        // another thread is already waiting
     1695        pcall->waitForFinishedCondition.wait(&pcall->mutex);
     1696    } else {
     1697        pcall->waitingForFinished = true;
     1698        pcall->mutex.unlock();
     1699
     1700        {
     1701            QDBusDispatchLocker locker(PendingCallBlockAction, this);
     1702            q_dbus_pending_call_block(pcall->pending);
     1703            // QDBusConnectionPrivate::processFinishedCall() is called automatically
     1704        }
     1705        pcall->mutex.lock();
     1706    }
    16961707}
    16971708
     
    16991710{
    17001711    QDBusConnectionPrivate *connection = const_cast<QDBusConnectionPrivate *>(call->connection);
     1712
     1713
    17011714
    17021715    QDBusMessage &msg = call->replyMessage;
     
    17291742    }
    17301743
     1744
     1745
     1746
     1747
     1748
     1749
    17311750    // Are there any watchers?
    17321751    if (call->watcherHelper)
     
    17361755        emit connection->callWithCallbackFailed(QDBusError(msg), call->sentMessage);
    17371756
    1738     if (call->pending)
    1739         q_dbus_pending_call_unref(call->pending);
    1740     call->pending = 0;
    1741 
    1742     if (call->autoDelete)
     1757    if (call->autoDelete) {
     1758        Q_ASSERT(!call->waitingForFinished); // can't wait on a call with autoDelete!
    17431759        delete call;
     1760
    17441761}
    17451762
     
    18831900    if (isServiceRegisteredByThread(message.service())) {
    18841901        // special case for local calls
    1885         QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate;
    1886         pcall->sentMessage = message;
     1902        QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this);
    18871903        pcall->replyMessage = sendWithReplyLocal(message);
    1888         pcall->connection = this;
    18891904
    18901905        return pcall;
     
    18921907
    18931908    checkThread();
    1894     QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate;
    1895     pcall->sentMessage = message;
     1909    QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this);
    18961910    pcall->ref = 0;
    18971911
     
    19171931
    19181932            pcall->pending = pending;
    1919             pcall->connection = this;
    19201933            q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0);
    19211934
     
    19411954    Q_ASSERT(pcall);
    19421955
    1943     // has it already finished (dispatched locally)?
     1956    // has it already finished (dispatched locally)?
    19441957    if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) {
    19451958        pcall->setReplyCallback(receiver, returnMethod);
     
    19491962    }
    19501963
     1964
     1965
     1966
     1967
     1968
     1969
     1970
     1971
    19511972    // has it already finished and is an error reply message?
    19521973    if (pcall->replyMessage.type() == QDBusMessage::ErrorMessage) {
    1953         if (errorMethod) {
    1954             pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
    1955             connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod);
    1956             pcall->watcherHelper->moveToThread(thread());
    1957         }
    19581974        processFinishedCall(pcall);
    19591975        delete pcall;
     
    19611977    }
    19621978
    1963     // has it already finished with error?
    1964     if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) {
    1965         delete pcall;
    1966         return 0;
    1967     }
    1968 
    19691979    pcall->autoDelete = true;
    19701980    pcall->ref.ref();
    1971 
    19721981    pcall->setReplyCallback(receiver, returnMethod);
    1973     if (errorMethod) {
    1974         pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
    1975         connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod);
    1976         pcall->watcherHelper->moveToThread(thread());
    1977     }
    19781982
    19791983    return 1;
     
    20052009            entry.signature == hook.signature &&
    20062010            entry.obj == hook.obj &&
    2007             entry.midx == hook.midx) {
     2011            entry.midx == hook.midx &&
     2012            entry.argumentMatch == hook.argumentMatch) {
    20082013            // no need to compare the parameters if it's the same slot
    20092014            return true;        // already there
     
    20472052            if (shouldWatchService(hook.service)) {
    20482053                WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
    2049                 if (data.refcount) {
    2050                     // already watching
    2051                     ++data.refcount;
    2052                 } else {
     2054                if (++data.refcount == 1) {
    20532055                    // we need to watch for this service changing
    20542056                    QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
     
    20902092            entry.signature == hook.signature &&
    20912093            entry.obj == hook.obj &&
    2092             entry.midx == hook.midx) {
     2094            entry.midx == hook.midx &&
     2095            entry.argumentMatch == hook.argumentMatch) {
    20932096            // no need to compare the parameters if it's the same slot
    20942097            disconnectSignal(it);
     
    21052108{
    21062109    const SignalHook &hook = it.value();
    2107 
    2108     WatchedServicesHash::Iterator sit = watchedServices.find(hook.service);
    2109     if (sit != watchedServices.end()) {
    2110         if (sit.value().refcount == 1) {
    2111             watchedServices.erase(sit);
    2112             QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
    2113             disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
    2114                           QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
    2115                           this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
    2116         } else {
    2117             --sit.value().refcount;
    2118         }
    2119     }
    21202110
    21212111    bool erase = false;
     
    21372127        qDBusDebug("Removing rule: %s", hook.matchRule.constData());
    21382128        q_dbus_bus_remove_match(connection, hook.matchRule, NULL);
     2129
     2130
     2131
     2132
     2133
     2134
     2135
     2136
     2137
     2138
     2139
     2140
     2141
     2142
    21392143    }
    21402144
Note: See TracChangeset for help on using the changeset viewer.