Changeset 240:936dde048c4e in SMSSender


Ignore:
Timestamp:
Jun 4, 2012 2:40:02 PM (7 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
default
Message:
  • Using Qt::DirectConnection? for all slots on STask to ensure liveness of the STask* parameter.
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • deploy/ubuntu/deploy

    r232 r240  
    6868}
    6969
     70development_version=""
     71get_development_version() {
     72    development_version=`egrep "DEVELOPMENT_VERSION=[[:alnum:]]*" $tmp_dir/smssender.pri | sed -e 's/DEVELOPMENT_VERSION=//'`
     73}
     74
    7075version_revision=""
    71 version_prefix="beta"
    7276get_version_revision() {
    7377    version_revision=`egrep "VERSION_REVISION=[[:digit:]]+" $tmp_dir/smssender.pri | sed -e 's/VERSION_REVISION=//'`
    7478   
    75     proceed "The shared revision is $version_prefix$version_revision. Proceed?"
     79    proceed "The shared revision is $development_version$version_revision. Proceed?"
    7680}
    7781
     
    121125        echo -n "  - Reading version... "
    122126        get_package_version $pkg
    123         pkg_with_version=${pkg_long}_$package_version.$version_prefix$version_revision
     127        pkg_with_version=${pkg_long}_$package_version.$development_version$version_revision
    124128        echo "$pkg_with_version."
    125129       
     
    153157        echo -n "  - Updating dependencies in debian/... "
    154158        get_package_version "smssender"
    155         minVersion=$package_version.$version_prefix$version_revision
    156         maxVersion=$package_version.$version_prefix$(( $version_revision + 1 ))
     159        minVersion=$package_version.$development_version$version_revision
     160        maxVersion=$package_version.$development_version$(( $version_revision + 1 ))
    157161        sed -r -i -e 's/smssender(-dev)? \(>= [^)]+\)/smssender\1 (>= '$minVersion')/g' \
    158162            $deploy_dir/$pkg_long/debian/control
     
    215219echo ""
    216220echo "***** Reading the version *****"
     221get_development_version
    217222get_version_revision
    218223
  • deploy/ubuntu/smssender-gateway-ethz/debian/control

    r213 r240  
    77    libqt4-dev,
    88    libqt4-sql-sqlite,
    9     smssender-dev (<< 3.0.0.alpha10), smssender-dev (>= 3.0.0.alpha9)
     9    smssender-dev (<< 3.0.1.beta2), smssender-dev (>= 3.0.1.beta1)
    1010Standards-Version: 3.9.2
    1111Homepage: http://smssender.gorrion.ch
     
    1414Architecture: any
    1515Depends: ${shlibs:Depends}, ${misc:Depends},
    16     smssender (<< 3.0.0.alpha10), smssender (>= 3.0.0.alpha9)
     16    smssender (<< 3.0.1.beta2), smssender (>= 3.0.1.beta1)
    1717Enhances: smssender
    1818Description: Fast and easy-to-use client for sending sms over internet gateways
     
    3030 This is the plugin for the ETHZ gateway.
    3131 .
    32  smssender is still alpha. Please use it with care.
     32 smssender is still beta. Please use it with care.
  • deploy/ubuntu/smssender-gateway-post/debian/control

    r213 r240  
    77    libqt4-dev,
    88    libqt4-sql-sqlite,
    9     smssender-dev (<< 3.0.0.alpha10), smssender-dev (>= 3.0.0.alpha9)
     9    smssender-dev (<< 3.0.1.beta2), smssender-dev (>= 3.0.1.beta1)
    1010Standards-Version: 3.9.2
    1111Homepage: http://smssender.gorrion.ch
     
    1414Architecture: any
    1515Depends: ${shlibs:Depends}, ${misc:Depends},
    16     smssender (<< 3.0.0.alpha10), smssender (>= 3.0.0.alpha9)
     16    smssender (<< 3.0.1.beta2), smssender (>= 3.0.1.beta1)
    1717Enhances: smssender
    1818Description: Fast and easy-to-use client for sending sms over internet gateways
     
    3030 This is the plugin for the Post gateway.
    3131 .
    32  smssender is still alpha. Please use it with care.
     32 smssender is still beta. Please use it with care.
  • deploy/ubuntu/smssender-gateway-schoolnet/debian/control

    r213 r240  
    77    libqt4-dev,
    88    libqt4-sql-sqlite,
    9     smssender-dev (<< 3.0.0.alpha10), smssender-dev (>= 3.0.0.alpha9)
     9    smssender-dev (<< 3.0.1.beta2), smssender-dev (>= 3.0.1.beta1)
    1010Standards-Version: 3.9.2
    1111Homepage: http://smssender.gorrion.ch
     
    1414Architecture: any
    1515Depends: ${shlibs:Depends}, ${misc:Depends},
    16     smssender (<< 3.0.0.alpha10), smssender (>= 3.0.0.alpha9)
     16    smssender (<< 3.0.1.beta2), smssender (>= 3.0.1.beta1)
    1717Enhances: smssender
    1818Description: Fast and easy-to-use client for sending sms over internet gateways
     
    3030 This is the plugin for the Schoolnet gateway.
    3131 .
    32  smssender is still alpha. Please use it with care.
     32 smssender is still beta. Please use it with care.
  • deploy/ubuntu/smssender-gateway-sunrise/debian/control

    r213 r240  
    77    libqt4-dev,
    88    libqt4-sql-sqlite,
    9     smssender-dev (<< 3.0.0.alpha10), smssender-dev (>= 3.0.0.alpha9)
     9    smssender-dev (<< 3.0.1.beta2), smssender-dev (>= 3.0.1.beta1)
    1010Standards-Version: 3.9.2
    1111Homepage: http://smssender.gorrion.ch
     
    1414Architecture: any
    1515Depends: ${shlibs:Depends}, ${misc:Depends},
    16     smssender (<< 3.0.0.alpha10), smssender (>= 3.0.0.alpha9)
     16    smssender (<< 3.0.1.beta2), smssender (>= 3.0.1.beta1)
    1717Enhances: smssender
    1818Description: Fast and easy-to-use client for sending sms over internet gateways
     
    3030 This is the plugin for the Sunrise gateway.
    3131 .
    32  smssender is still alpha. Please use it with care.
     32 smssender is still beta. Please use it with care.
  • deploy/ubuntu/smssender-gateway-swisscomxtrazone/debian/control

    r213 r240  
    77    libqt4-dev,
    88    libqt4-sql-sqlite,
    9     smssender-dev (<< 3.0.0.alpha10), smssender-dev (>= 3.0.0.alpha9)
     9    smssender-dev (<< 3.0.1.beta2), smssender-dev (>= 3.0.1.beta1)
    1010Standards-Version: 3.9.2
    1111Homepage: http://smssender.gorrion.ch
     
    1414Architecture: any
    1515Depends: ${shlibs:Depends}, ${misc:Depends},
    16     smssender (<< 3.0.0.alpha10), smssender (>= 3.0.0.alpha9)
     16    smssender (<< 3.0.1.beta2), smssender (>= 3.0.1.beta1)
    1717Enhances: smssender
    1818Description: Fast and easy-to-use client for sending sms over internet gateways
     
    3030 This is the plugin for the Swisscom Xtra-Zone gateway.
    3131 .
    32  smssender is still alpha. Please use it with care.
     32 smssender is still beta. Please use it with care.
    3333
  • deploy/ubuntu/smssender/debian/control

    r175 r240  
    2828 tons of clicks on a website. Enjoy.
    2929 .
    30  smssender is still alpha. Please use it with care.
     30 smssender is still beta. Please use it with care.
    3131
    3232Package: smssender-dev
     
    4848 This package contains the development files.
    4949 .
    50  smssender is still alpha. Please use it with care.
     50 smssender is still beta. Please use it with care.
  • gateways/Schoolnet/src/business/deepthought/deepthought_daemon_deepthought.cpp

    r228 r240  
    7373        // Do run
    7474        STask* task = new FetchDataFromDeepThoughtTask();
    75         connect(task, SIGNAL(finished(STask*)), this, SIGNAL(dataFetchFinished(STask*)));
     75        connect(task, SIGNAL(finished(STask*)), this, SIGNAL(dataFetchFinished(STask*)), Qt::DirectConnection);
    7676        task->start();
    7777    }
  • gateways/Schoolnet/src/business/deepthought/deepthought_daemon_schoolnet.cpp

    r230 r240  
    4444
    4545    connect(DeepThoughtHelper::instance()->deepThoughtDaemon(), SIGNAL(dataFetchFinished(STask*)),
    46             this, SLOT(onDeepThoughtDataFetchFinished(STask*)));
     46            this, SLOT(onDeepThoughtDataFetchFinished(STask*)), Qt::DirectConnection);
    4747}
    4848
  • gateways/Schoolnet/src/ui/models/questiontreemodel.cpp

    r230 r240  
    248248                            // Reload the list after the task finished, so that the list gets reloaded even if no new
    249249                            // knowledge about the answer correctness is gained (Already answered questions).
    250                             connect(task, SIGNAL(finished(STask*)), this, SLOT(onAnswerProvidingTaskFinished(STask*)), Qt::UniqueConnection); // The task can be reused and gets returned multiple times then
     250                            disconnect(task, SIGNAL(finished(STask*)), this, SLOT(onAnswerProvidingTaskFinished(STask*))); // Remove existing connections
     251                            connect(task, SIGNAL(finished(STask*)), this, SLOT(onAnswerProvidingTaskFinished(STask*)), Qt::DirectConnection); // Add new connection
    251252                        } endResetModel();
    252253                    }
  • lib/datatypes/src/abstract/abstractaccount.cpp

    r239 r240  
    148148    IAccountInitTask* task = doCreateInitTask();
    149149    if (task) {
    150         connect(task, SIGNAL(finished(STask*)), this, SLOT(onInitFinished(STask*)));
     150        connect(task, SIGNAL(finished(STask*)), this, SLOT(onInitFinished(STask*)), Qt::DirectConnection);
    151151    }
    152152
     
    253253    IAccountLoginTask* loginTask = doCreateLoginTask();
    254254    if (loginTask) {
    255         connect(loginTask, SIGNAL(finished(STask*)), this, SLOT(onLoginFinished(STask*)));
     255        connect(loginTask, SIGNAL(finished(STask*)), this, SLOT(onLoginFinished(STask*)), Qt::DirectConnection);
    256256    }
    257257
  • lib/datatypes/src/managers/staskmanager.cpp

    r237 r240  
    4343    foreach (STask* task, runningTasks_) {
    4444        disconnect(task, 0, this, 0);
    45         connect(task, SIGNAL(finished(STask*)), task, SLOT(deleteLater()));
     45        connect(task, SIGNAL(finished(STask*)), task, SLOT(deleteLater()), Qt::DirectConnection);
    4646    }
    4747    runningTasks_.clear();
     
    173173        runningTasks_.append(runnableTask);
    174174
    175         connect(runnableTask, SIGNAL(finished(STask*)), this, SLOT(onTaskFinished(STask*)));
     175        connect(runnableTask, SIGNAL(finished(STask*)), this, SLOT(onTaskFinished(STask*)), Qt::DirectConnection);
    176176    }
    177177    locker.unlock();
     
    210210    runningTasks_.removeAll(task);
    211211
    212     emit taskFinished(task);
    213 
    214212    /* This is needed, that we safely can call deleteLater on task. Otherwise it is not guaranteed, that
    215        the task in the above signal is still alive in all slots. */
     213       the task is still alive in all slots of taskFinished. */
    216214    Q_ASSERT(task->thread() == thread());
    217215
     216    emit taskFinished(task); // task already deleted in slot? -> use Qt::DirectConnection
     217
    218218    task->deleteLater();
    219219
  • lib/datatypes/src/stask.cpp

    r231 r240  
    9696
    9797void STask::startSubTask(STask* subTask, bool waitFor) {
     98    QMutexLocker locker(&dataMutex());
     99
    98100    subTasks_.append(subTask);
    99     connect(subTask, SIGNAL(finished(STask*)), this, SLOT(onSubTaskFinished(STask*)), Qt::QueuedConnection);
     101    connect(subTask, SIGNAL(finished(STask*)), this, SLOT(onSubTaskFinished(STask*)), Qt::DirectConnection);
    100102    connect(subTask, SIGNAL(exceptionOccured(STask*)), this, SLOT(onSubTaskExceptionOccured(STask*)), Qt::DirectConnection);
    101103
     
    108110}
    109111void STask::onSubTaskFinished(STask* subTask) {
     112    QMutexLocker locker(&dataMutex());
     113
    110114    subTasks_.removeAll(subTask);
    111115}
     
    435439void STask::enqueueAfter(STask* other, bool onlyIfSuccessful) {
    436440    if (onlyIfSuccessful) {
    437         connect(other, SIGNAL(finished(STask*)), this, SLOT(startIfSuccessful(STask*)));
     441        connect(other, SIGNAL(finished(STask*)), this, SLOT(startIfSuccessful(STask*)), Qt::DirectConnection);
    438442    } else {
    439443        addBlockingTask(other);
  • lib/datatypes/src/stask.h

    r228 r240  
    122122
    123123signals:
    124     void changed(STask* task, STask::Property property);
    125 
    126     void started(STask* task);
    127     void cancelled(STask* task);
    128     void exceptionOccured(STask* task);
    129     void finished(STask* task);
     124    void changed(STask* task, STask::Property property); // Always use Qt::DirectConnection when connecting!
     125
     126    void started(STask* task); // Always use Qt::DirectConnection when connecting!
     127    void cancelled(STask* task); // Always use Qt::DirectConnection when connecting!
     128    void exceptionOccured(STask* task); // Always use Qt::DirectConnection when connecting!
     129    void finished(STask* task); // Always use Qt::DirectConnection when connecting!
    130130
    131131protected:
  • src/business/bcaccountinitmanager.cpp

    r217 r240  
    5757
    5858        connect(initTask, SIGNAL(finished(STask*)),
    59                 this, SLOT(onAccountInitFinished(STask*)));
     59                this, SLOT(onAccountInitFinished(STask*)), Qt::DirectConnection);
    6060        connect(initTask, SIGNAL(exceptionOccured(STask*)),
    61                 this, SLOT(onAccountInitFailed(STask*)));
     61                this, SLOT(onAccountInitFailed(STask*)), Qt::DirectConnection);
    6262        connect(account, SIGNAL(initStateChanged(IAccount*)),
    6363                this, SIGNAL(accountInitStateChanged(IAccount*)));
  • src/ui/components/taskstatusbar.cpp

    r229 r240  
    5454    setLayout(l);
    5555
    56     connect(STaskManager::instance(), SIGNAL(taskEnqueued(STask*)), this, SLOT(taskEnqueued(STask*)));
    57     connect(STaskManager::instance(), SIGNAL(taskDequeued(STask*)), this, SLOT(taskDequeued(STask*)));
    58     connect(STaskManager::instance(), SIGNAL(taskFinished(STask*)), this, SLOT(taskFinished(STask*)));
     56    connect(STaskManager::instance(), SIGNAL(taskEnqueued(STask*)), this, SLOT(taskEnqueued(STask*)), Qt::DirectConnection);
     57    connect(STaskManager::instance(), SIGNAL(taskDequeued(STask*)), this, SLOT(taskDequeued(STask*)), Qt::DirectConnection);
     58    connect(STaskManager::instance(), SIGNAL(taskFinished(STask*)), this, SLOT(taskFinished(STask*)), Qt::DirectConnection);
    5959
    6060    foreach (STask* task, STaskManager::instance()->queuedTasks()) {
     
    6969
    7070void TaskStatusBar::updateFields() {
     71    Q_ASSERT(QThread::currentThread() == thread());
     72
    7173    QMutexLocker locker(&updateMutex_);
    7274
     
    157159            this, SLOT(taskChanged()));
    158160
    159     updateFields();
     161    metaObject()->invokeMethod(this, "updateFields", Qt::QueuedConnection); // Run it in the main thread
    160162}
    161163void TaskStatusBar::taskFinished(STask* task) {
     
    165167    disconnect(task, 0, this, 0);
    166168
    167     updateFields();
     169    metaObject()->invokeMethod(this, "updateFields", Qt::QueuedConnection); // Run it in the main thread
    168170}
    169171
    170172void TaskStatusBar::taskChanged() {
    171     updateFields();
     173    metaObject()->invokeMethod(this, "updateFields", Qt::QueuedConnection); // Run it in the main thread
    172174}
  • src/ui/vcimportcontacts/vcimportcontacts_page_import.cpp

    r230 r240  
    5656    foreach (IContactImporter *importer, dataManager_->activatedImporters()) {
    5757        ImportTask *importTask = new ImportTask(importer);
    58         connect(importTask, SIGNAL(finished(STask*)), this, SLOT(importTaskFinished(STask*)));
     58        connect(importTask, SIGNAL(finished(STask*)), this, SLOT(importTaskFinished(STask*)), Qt::DirectConnection);
    5959        ++runningTasks_;
    6060        importTask->start();
  • src/ui/vcmain/vcmain.cpp

    r237 r240  
    380380        if (task) {
    381381            connect(task, SIGNAL(exceptionOccured(STask*)),
    382                     this, SLOT(onSMSSendingErrorOccured(STask*)));
     382                    this, SLOT(onSMSSendingErrorOccured(STask*)), Qt::DirectConnection);
    383383            connect(task, SIGNAL(finished(STask*)),
    384                     this, SLOT(onSMSSendingFinished(STask*)));
     384                    this, SLOT(onSMSSendingFinished(STask*)), Qt::DirectConnection);
    385385
    386386            QDialog* sd = BCGuiManager::instance()->createNewSendingDialog(this, task);
     
    671671
    672672void VCMain::onSMSSendingFinished(STask* task) {
    673     if (task->taskResult() == STask::rSuccess) {
     673    metaObject()->invokeMethod(this, "smsSendingFinished", Qt::QueuedConnection, Q_ARG(STask::Result, task->taskResult()));
     674}
     675void VCMain::smsSendingFinished(STask::Result taskResult) {
     676    Q_ASSERT(QThread::currentThread() == thread());
     677
     678    if (taskResult == STask::rSuccess) {
    674679        ui.lblSMSSent->show();
    675680
     
    683688
    684689void VCMain::onSMSSendingErrorOccured(STask* task) {
    685     qWarning() << task->exception().chainedWhat();
    686     BCGuiManager::instance()->execErrorDialog(tr("An error occured while sending the sms."), task->exception());
     690    metaObject()->invokeMethod(this, "smsSendingErrorOccured", Qt::QueuedConnection, Q_ARG(const EException&, task->exception()));
     691}
     692void VCMain::smsSendingErrorOccured(const EException &exception) {
     693    Q_ASSERT(QThread::currentThread() == thread());
     694
     695    qWarning() << exception.chainedWhat();
     696    BCGuiManager::instance()->execErrorDialog(tr("An error occured while sending the sms."), exception);
    687697}
    688698
  • src/ui/vcmain/vcmain.h

    r217 r240  
    152152
    153153private slots:
     154    void smsSendingFinished(STask::Result taskResult);
     155    void smsSendingErrorOccured(const EException &exception);
     156
     157private slots:
    154158    void checkForAccounts();
    155159};
  • src/ui/vcsendingdialog/vcsendingdialog.cpp

    r217 r240  
    3636        // Connect to the change events
    3737        connect(smsSendTask, SIGNAL(changed(STask*, STask::Property)),
    38                 this, SLOT(onSmsSendingStatusChanged(STask*, STask::Property)));
     38            this, SLOT(onSmsSendingStatusChanged(STask*, STask::Property)), Qt::DirectConnection);
    3939        connect(smsSendTask, SIGNAL(finished(STask*)),
    40                 this, SLOT(onSmsSendingFinished(STask*)));
     40            this, SLOT(onSmsSendingFinished(STask*)), Qt::DirectConnection);
    4141
    4242        if (smsSendTask->isFinished()) {
     
    4747void VCSendingDialog::onSmsSendingStatusChanged(STask* task, STask::Property property) {
    4848    switch (property) {
    49         case STask::pProgress: {
    50             ui.progressBar->setValue(task->progress());
    51             break;
    52         }
    53 
     49        case STask::pProgress:
    5450        case STask::pTitle: {
    55             ui.lblStatus->setText(task->title());
     51            metaObject()->invokeMethod(this, "updateSendingStatus", Qt::QueuedConnection, Q_ARG(uint, task->progress()), Q_ARG(QString, task->title()));
    5652            break;
    5753        }
     
    6157    }
    6258}
     59void VCSendingDialog::updateSendingStatus(uint progress, const QString &title) {
     60    Q_ASSERT(QThread::currentThread() == thread());
     61
     62    ui.progressBar->setValue(progress);
     63    ui.lblStatus->setText(title);
     64}
     65
    6366void VCSendingDialog::onSmsSendingFinished(STask* task) {
     67    metaObject()->invokeMethod(this, "smsSendingFinished", Qt::QueuedConnection, Q_ARG(STask::Result, task->taskResult()));
     68}
     69void VCSendingDialog::smsSendingFinished(STask::Result taskResult) {
     70    Q_ASSERT(QThread::currentThread() == thread());
     71
    6472    ui.btnCancelSmsSending->setEnabled(false);
    65     switch (task->taskResult()) {
     73    switch (taskResult) {
    6674        case STask::rSuccess: {
    6775            ui.lblStatus->setText(tr("The sms has been sent."));
  • src/ui/vcsendingdialog/vcsendingdialog.h

    r217 r240  
    4040
    4141private slots:
     42    void updateSendingStatus(uint progress, const QString &title);
     43    void smsSendingFinished(STask::Result taskResult);
     44
     45private slots:
    4246    void onSmsSendingStatusChanged(STask* task, STask::Property property);
    4347    void onSmsSendingFinished(STask* task);
Note: See TracChangeset for help on using the changeset viewer.