VirtualBox

Changeset 71310 in vbox


Ignore:
Timestamp:
Mar 13, 2018 9:39:12 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt bugref:6699 Stop wasting threads for listening terminated guest processes

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.cpp

    r71298 r71310  
    395395    {
    396396        connect(m_pQtGuestListener->getWrapped(), &UIMainEventListener::sigGuestSessionUnregistered,
    397                 this, &UIGuestControlFileManager::sltGuestSessionUnregistered, Qt::DirectConnection);
     397                this, &UIGuestControlFileManager::sltGuestSessionUnregistered);
    398398    }
    399399    if (m_pSessionCreateWidget)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlTreeItem.cpp

    r71191 r71310  
    221221void UIGuestSessionTreeItem::prepareConnections()
    222222{
     223
     224    qRegisterMetaType<CGuestProcess>();
    223225    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionStatedChanged,
    224             this, &UIGuestSessionTreeItem::sltGuestSessionUpdated, Qt::DirectConnection);
     226            this, &UIGuestSessionTreeItem::sltGuestSessionUpdated);
    225227    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestProcessRegistered,
    226             this, &UIGuestSessionTreeItem::sltGuestProcessRegistered, Qt::DirectConnection);
     228            this, &UIGuestSessionTreeItem::sltGuestProcessRegistered);
    227229    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestProcessUnregistered,
    228             this, &UIGuestSessionTreeItem::sltGuestProcessUnregistered, Qt::DirectConnection);
     230            this, &UIGuestSessionTreeItem::sltGuestProcessUnregistered);
    229231}
    230232
     
    275277void UIGuestSessionTreeItem::addGuestProcess(CGuestProcess guestProcess)
    276278{
     279    /* Dont add the tree items for already terminated or currently being terminated
     280       guest processes: */
     281    KProcessStatus processStatus = guestProcess.GetStatus();
     282    if (processStatus != KProcessStatus_Starting &&
     283        processStatus != KProcessStatus_Started &&
     284        processStatus != KProcessStatus_Paused)
     285        return;
     286
    277287    UIGuestProcessTreeItem *newItem = new UIGuestProcessTreeItem(this, guestProcess);
    278288    connect(newItem, &UIGuestProcessTreeItem::sigGuestProcessErrorText,
     
    329339void UIGuestProcessTreeItem::prepareConnections()
    330340{
     341    qRegisterMetaType<CGuestProcessStateChangedEvent>();
    331342    connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestProcessStateChanged,
    332             this, &UIGuestProcessTreeItem::sltGuestProcessUpdated, Qt::DirectConnection);
     343            this, &UIGuestProcessTreeItem::sltGuestProcessUpdated);
    333344}
    334345
     
    359370        CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError();
    360371        if (cErrorInfo.isOk() && cErrorInfo.GetResultCode() != S_OK)
    361         {
    362             /* For some reason I am yet to find this emit is not working.
    363                Thus we are calling the parent's function directly: */
    364             //emit sigGuestProcessErrorText(cErrorInfo.GetText());
    365             UIGuestSessionTreeItem *sessionParent = dynamic_cast<UIGuestSessionTreeItem*>(QTreeWidgetItem::parent());
    366             if (sessionParent)
    367             {
    368                 sessionParent->errorString(cErrorInfo.GetText().toStdString().c_str());
    369             }
    370         }
     372            emit sigGuestProcessErrorText(cErrorInfo.GetText());
     373
    371374    }
    372375    setColumnText();
     376    KProcessStatus processStatus = m_comGuestProcess.GetStatus();
     377    if (processStatus != KProcessStatus_Starting &&
     378        processStatus !=  KProcessStatus_Started &&
     379        processStatus !=  KProcessStatus_Paused)
     380    {
     381        this->deleteLater();
     382    }
    373383}
    374384
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlWidget.cpp

    r71191 r71310  
    251251    {
    252252        connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionRegistered,
    253                 this, &UIGuestControlWidget::sltGuestSessionRegistered, Qt::DirectConnection);
     253                this, &UIGuestControlWidget::sltGuestSessionRegistered);
    254254        connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionUnregistered,
    255                 this, &UIGuestControlWidget::sltGuestSessionUnregistered, Qt::DirectConnection);
     255                this, &UIGuestControlWidget::sltGuestSessionUnregistered);
    256256    }
    257257}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette