VirtualBox

Ignore:
Timestamp:
Mar 28, 2014 7:21:17 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 7329: Trying to fix the crash in machine-preview paint event: Caching VM accessibility status outside the paint-event.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp

    r50041 r50924  
    112112void UIGMachinePreview::setMachine(const CMachine& machine)
    113113{
     114    /* Pause: */
    114115    stop();
     116
     117    /* Assign new machine: */
    115118    m_machine = machine;
     119
     120    /* Fetch machine data: */
     121    m_strPreviewName = tr("No preview");
     122    if (!m_machine.isNull())
     123        m_strPreviewName = m_machine.GetAccessible() ? m_machine.GetName() :
     124                           QApplication::translate("UIVMListView", "Inaccessible");
     125
     126    /* Resume: */
    116127    restart();
    117128}
     
    299310        pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_pbgFullImage);
    300311
    301         /* Compose name: */
    302         QString strName = tr("No preview");
    303         if (!m_machine.isNull())
    304             strName = m_machine.GetAccessible() ? m_machine.GetName() :
    305                       QApplication::translate("UIVMListView", "Inaccessible");
    306         /* Paint that name: */
     312        /* Paint preview name: */
    307313        QFont font = pPainter->font();
    308314        font.setBold(true);
     
    318324            font.setPixelSize((int)h);
    319325            pPainter->setFont(font);
    320             r = pPainter->boundingRect(m_vRect, fFlags, strName);
     326            r = pPainter->boundingRect(m_vRect, fFlags, m_strPreviewName);
    321327        }
    322328        while ((r.height() > m_vRect.height() || r.width() > m_vRect.width()) && cMax-- != 0);
    323329        pPainter->setPen(Qt::white);
    324         pPainter->drawText(m_vRect, fFlags, strName);
     330        pPainter->drawText(m_vRect, fFlags, m_strPreviewName);
    325331    }
    326332}
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h

    r50041 r50924  
    113113    QPixmap *m_pbgFullImage;
    114114    QImage *m_pPreviewImg;
     115    QString m_strPreviewName;
    115116    static UpdateIntervalMap m_intervals;
    116117};
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