VirtualBox

Changeset 45580 in vbox for trunk


Ignore:
Timestamp:
Apr 16, 2013 6:34:32 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: added some locking to the framebuffer code to hopefully prevent crashes on shut-down.

File:
1 edited

Legend:

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

    r44529 r45580  
    159159
    160160    NOREF(uScreenId);
    161     /* A resize event can happen while we are switching machine view classes,
    162      * but we synchronise afterwards so that shouldn't be a problem.  We must
    163      * temporarily remove the framebuffer in Display though while switching
    164      * to respect the thread synchronisation logic (see UIFrameBuffer.h). */
     161    *pbFinished = FALSE;
     162    lock();  /* See comment in setView(). */
    165163    if (m_pMachineView)
    166164        QApplication::postEvent(m_pMachineView,
     
    169167                                                  uWidth, uHeight));
    170168    else
    171     {
    172169        /* Report to the VM thread that we finished resizing and rely on the
    173170         * synchronisation when the new view is attached. */
    174171        *pbFinished = TRUE;
    175         return S_OK;
    176     }
    177 
    178     *pbFinished = FALSE;
     172    unlock();
     173
    179174    return S_OK;
    180175}
     
    201196    *pbSupported = TRUE;
    202197
    203     if (!m_pMachineView)
    204         return S_OK;
    205     QSize screen = m_pMachineView->maxGuestSize();
     198    lock();  /* See comment in setView(). */
     199    QSize screen;
     200    if (m_pMachineView)
     201        screen = m_pMachineView->maxGuestSize();
     202    unlock();
    206203    if (   (screen.width() != 0)
    207204        && (uWidth > (ULONG)screen.width())
     
    250247        ++ rects;
    251248    }
    252     QApplication::postEvent(m_pMachineView, new UISetRegionEvent(reg));
     249    lock();  /* See comment in setView(). */
     250    if (m_pMachineView)
     251        QApplication::postEvent(m_pMachineView, new UISetRegionEvent(reg));
     252    unlock();
    253253
    254254    return S_OK;
     
    272272void UIFrameBuffer::setView(UIMachineView * pView)
    273273{
     274    /* We are not supposed to use locking for things which are done
     275     * on the GUI thread.  Unfortunately I am not clever enough to
     276     * understand the original author's wise synchronisation logic
     277     * so I will do it anyway. */
     278    lock();
    274279    m_pMachineView = pView;
    275280    m_WinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0;
    276 }
     281    unlock();
     282}
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