Changeset 86206 in vbox for trunk/src/VBox
- Timestamp:
- Sep 21, 2020 7:41:18 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
r86205 r86206 588 588 } 589 589 590 void UIProgress::cancel() 591 { 592 /* Make sure progress hasn't aborted/finished already: */ 593 if (!m_comProgress.isOk() || m_comProgress.GetCompleted()) 594 return; 595 596 /* Cancel progress first of all: */ 597 m_comProgress.Cancel(); 598 599 /* We are creating a locally-scoped event-loop object, 600 * but holding a pointer to it for a control needs: */ 601 QEventLoop eventLoop; 602 m_pEventLoopCancel = &eventLoop; 603 604 /* Guard ourself for the case 605 * we self-destroyed in our event-loop: */ 606 QPointer<UIProgress> guard = this; 607 608 /* Start the blocking event-loop: */ 609 eventLoop.exec(); 610 611 /* Event-loop object unblocked, 612 * Are we still valid? */ 613 if (guard.isNull()) 614 return; 615 616 /* Cleanup the pointer finally: */ 617 m_pEventLoopCancel = 0; 618 } 619 590 620 void UIProgress::sltHandleProgressPercentageChange(const QUuid &, const int iPercent) 591 621 { … … 605 635 if (m_pEventLoopExec) 606 636 m_pEventLoopExec->exit(); 637 /* Exit from the cancel event-loop if there is any: */ 638 if (m_pEventLoopCancel) 639 m_pEventLoopCancel->exit(); 640 641 emit sigProgressComplete(); 607 642 } 608 643 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h
r86205 r86206 194 194 void sigProgressError(QString strErrorInfo); 195 195 196 /** Notifies listeners about wrapped CProgress complete. */ 197 void sigProgressComplete(); 198 196 199 public: 197 200 … … 204 207 /** Executes the progress within local event-loop. */ 205 208 void exec(); 209 /** Cancels the progress within local event-loop. */ 210 void cancel(); 206 211 207 212 private slots: … … 231 236 /** Holds the exec event-loop instance. */ 232 237 QPointer<QEventLoop> m_pEventLoopExec; 238 /** Holds the cancel event-loop instance. */ 239 QPointer<QEventLoop> m_pEventLoopCancel; 233 240 }; 234 241
Note:
See TracChangeset
for help on using the changeset viewer.