VirtualBox

Changeset 59498 in vbox


Ignore:
Timestamp:
Jan 27, 2016 4:35:56 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8069: LogWindow: Removing unnecessary dynamic-allocation of QString.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

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

    r58859 r59498  
    502502        QTextEdit *pCurrentPage = m_pViewer->currentLogPage();
    503503        AssertReturnVoid(pCurrentPage);
    504         const QString *pCurrentLog = m_pViewer->currentLog();
    505         if (pCurrentLog)
    506         {
    507             QString strInputText(pCurrentLog->data());
     504        QString strInputText = m_pViewer->currentLog();
     505        if (!strInputText.isNull())
     506        {
    508507            /* Prepare filter-data: */
    509508            QString strFilteredText;
     
    755754
    756755    /* Clearing old data if any: */
    757     for (int index = 0; index < m_book.count(); index++)
    758     {
    759         QTextEdit* pLogPage = m_book.at(index).second;
    760         if (pLogPage)
    761             delete m_logMap[pLogPage];
    762     }
    763756    m_book.clear();
    764757    m_logMap.clear();
     
    805798                m_book << qMakePair(strFileName, pLogViewer);
    806799                /* Add the log-text to the map: */
    807                 m_logMap[pLogViewer] = new QString(strText);
     800                m_logMap[pLogViewer] = strText;
    808801                isAnyLogPresent = true;
    809802            }
     
    978971    saveSettings();
    979972
    980     /* Delete the log if not already: */
    981     for (int index = 0; index < m_book.count(); index++)
    982     {
    983         QTextEdit* pLogPage = m_book.at(index).second;
    984         if (pLogPage)
    985             delete m_logMap[pLogPage];
    986     }
    987 
    988973    /* Remove log-viewer: */
    989974    if (!m_machine.isNull())
     
    11111096}
    11121097
    1113 const QString* UIVMLogViewer::currentLog()
     1098const QString& UIVMLogViewer::currentLog()
    11141099{
    11151100    return m_logMap[currentLogPage()];
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h

    r58859 r59498  
    4545typedef QPair<QString, QTextEdit*> LogPage;
    4646typedef QList<LogPage> LogBook;
    47 typedef QMap<QTextEdit*, QString*> VMLogMap;
     47typedef QMap<QTextEdit*, QString> VMLogMap;
    4848
    4949/** QMainWindow extension
     
    110110    QTextEdit* createLogPage(const QString &strPage);
    111111    /** Returns the content of current log-page. */
    112     const QString* currentLog();
     112    const QString& currentLog();
    113113
    114114    /** Load settings helper. */
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