VirtualBox

Changeset 83353 in vbox for trunk


Ignore:
Timestamp:
Mar 20, 2020 4:01:35 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9623: UIMediumEnumerator: Make sure each medium being registered (and that way enumerated) and unregistered just once; This allows to filter out repetitive registration messages coming from Main.

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

Legend:

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

    r83205 r83353  
    314314        if (!medium(uMediumId).isNull())
    315315        {
    316             /* This medium can be known because of async event nature. Currently medium registration event
    317              * comes very late and other even unrealted events can come before it and request for this
    318              * particular medium enumeration, so we just ignore that and enumerate this UIMedium again. */
    319             LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} is cached already and will be enumerated..\n",
    320                      uMediumId.toString().toUtf8().constData()));
    321             createMediumEnumerationTask(m_media.value(uMediumId));
     316            /* This medium can be known because of async event nature. Currently medium registration event comes
     317             * very late and other even unrelated events can come before it and request for this particular medium
     318             * enumeration, so we just ignore repetitive events but enumerate this UIMedium at least once if it
     319             * wasn't registered before. */
     320            if (!m_registeredMediaIds.contains(uMediumId))
     321            {
     322                LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} is cached but not registered already, so will be enumerated..\n",
     323                         uMediumId.toString().toUtf8().constData()));
     324                createMediumEnumerationTask(m_media.value(uMediumId));
     325
     326                /* Mark medium registered: */
     327                m_registeredMediaIds << uMediumId;
     328            }
    322329        }
    323330        else
     
    347354                /* Enumerate corresponding UIMedium: */
    348355                createMediumEnumerationTask(m_media.value(uMediumId));
     356
     357                /* Mark medium registered: */
     358                m_registeredMediaIds << uMediumId;
    349359            }
    350360        }
     
    379389            enumerateAllMediaOfMediumWithId(uMediumId, result);
    380390        }
     391
     392        /* Mark medium unregistered: */
     393        m_registeredMediaIds.remove(uMediumId);
    381394    }
    382395}
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r82968 r83353  
    161161    QSet<UITask*>  m_tasks;
    162162
    163     /** Holds a map of current cached (enumerated) media. */
     163    /** Holds a map of currently cached (enumerated) media. */
    164164    UIMediumMap  m_media;
     165    /** Holds a set of currently registered media IDs. */
     166    QSet<QUuid>  m_registeredMediaIds;
    165167};
    166168
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