VirtualBox

Ignore:
Timestamp:
Sep 28, 2020 2:44:14 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: UIMainEventListener: A bit of cleanup related to source/listener [un]registration.

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

Legend:

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

    r86079 r86322  
    8080public:
    8181
    82     /** Constructs Main events listener thread redirecting events from @a comSource to @a comListener. */
    83     UIMainEventListeningThread(const CEventSource &comSource, const CEventListener &comListener);
     82    /** Constructs Main events listener thread redirecting events from @a comSource to @a comListener.
     83      * @param  comSource    Brings event source we are creating this thread for.
     84      * @param  comListener  Brings event listener we are creating this thread for. */
     85    UIMainEventListeningThread(const CEventSource &comSource,
     86                               const CEventListener &comListener);
    8487    /** Destructs Main events listener thread. */
    85     ~UIMainEventListeningThread();
     88    virtual ~UIMainEventListeningThread() /* override */;
    8689
    8790protected:
     
    98101
    99102    /** Holds the Main event source reference. */
    100     CEventSource m_comSource;
     103    CEventSource          m_comSource;
    101104    /** Holds the Main event listener reference. */
    102     CEventListener m_comListener;
     105    CEventListener        m_comListener;
    103106
    104107    /** Holds the mutex instance which protects thread access. */
     
    113116*********************************************************************************************************************************/
    114117
    115 UIMainEventListeningThread::UIMainEventListeningThread(const CEventSource &comSource, const CEventListener &comListener)
     118UIMainEventListeningThread::UIMainEventListeningThread(const CEventSource &comSource,
     119                                                       const CEventListener &comListener)
    116120    : m_comSource(comSource)
    117121    , m_comListener(comListener)
     
    201205}
    202206
    203 void UIMainEventListener::registerSource(const CEventSource &comSource, const CEventListener &comListener)
     207void UIMainEventListener::registerSource(const CEventSource &comSource,
     208                                         const CEventListener &comListener)
    204209{
    205210    /* Make sure source and listener are valid: */
     
    208213
    209214    /* Create thread for passed source: */
    210     m_threads << new UIMainEventListeningThread(comSource, comListener);
    211     /* And start it: */
    212     m_threads.last()->start();
     215    UIMainEventListeningThread *pThread = new UIMainEventListeningThread(comSource, comListener);
     216    if (pThread)
     217    {
     218        /* Register & start it: */
     219        m_threads << pThread;
     220        pThread->start();
     221    }
    213222}
    214223
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h

    r86077 r86322  
    209209    void uninit() {}
    210210
    211     /** Registers event @a source for passive event @a listener. */
    212     void registerSource(const CEventSource &comSource, const CEventListener &comListener);
     211    /** Registers event source for passive event listener by creating a listening thread.
     212      * @param  comSource    Brings event source we are creating listening thread for.
     213      * @param  comListener  Brings event listener we are creating listening thread for. */
     214    void registerSource(const CEventSource &comSource,
     215                        const CEventListener &comListener);
    213216    /** Unregisters event sources. */
    214217    void unregisterSources();
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