VirtualBox

Changeset 73469 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 3, 2018 12:04:15 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: Made UIMainEventListeningThread::~UIMainEventListeningThread() more debugger friendly and added a todo about not deleting the thread object for threads that are still running.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp

    r71454 r73469  
    116116    , m_fShutdown(false)
    117117{
     118    setObjectName("UIMainEventListeningThread");
    118119}
    119120
     
    123124    setShutdown(true);
    124125
    125     /* And wait 30 seconds for run() to finish: */
    126     wait(30000);
     126    /* And wait 30 seconds for run() to finish (1 sec increments to help with
     127       delays incurred debugging and prevent suicidal use-after-free behaviour): */
     128    uint32_t i = 30000;
     129    do
     130        wait(1000);
     131    while (i-- > 0 && !isFinished());
    127132}
    128133
     
    204209{
    205210    /* Wipe out the threads: */
     211    /** @todo r=bird: The use of qDeleteAll here is unsafe because it won't take
     212     * QThread::wait() timeouts into account, and may delete the QThread object
     213     * while the thread is still running, causing heap corruption/crashes once
     214     * the thread awakens and gets on with its termination.
     215     * Observed with debugger + paged heap.
     216     *
     217     * Should use specialized thread list which only deletes the threads after
     218     * isFinished() returns true, leaving them alone on timeout failures. */
    206219    qDeleteAll(m_threads);
    207220}
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