Changeset 86322 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 28, 2020 2:44:14 PM (4 years ago)
- 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 80 80 public: 81 81 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); 84 87 /** Destructs Main events listener thread. */ 85 ~UIMainEventListeningThread();88 virtual ~UIMainEventListeningThread() /* override */; 86 89 87 90 protected: … … 98 101 99 102 /** Holds the Main event source reference. */ 100 CEventSource m_comSource;103 CEventSource m_comSource; 101 104 /** Holds the Main event listener reference. */ 102 CEventListener m_comListener;105 CEventListener m_comListener; 103 106 104 107 /** Holds the mutex instance which protects thread access. */ … … 113 116 *********************************************************************************************************************************/ 114 117 115 UIMainEventListeningThread::UIMainEventListeningThread(const CEventSource &comSource, const CEventListener &comListener) 118 UIMainEventListeningThread::UIMainEventListeningThread(const CEventSource &comSource, 119 const CEventListener &comListener) 116 120 : m_comSource(comSource) 117 121 , m_comListener(comListener) … … 201 205 } 202 206 203 void UIMainEventListener::registerSource(const CEventSource &comSource, const CEventListener &comListener) 207 void UIMainEventListener::registerSource(const CEventSource &comSource, 208 const CEventListener &comListener) 204 209 { 205 210 /* Make sure source and listener are valid: */ … … 208 213 209 214 /* 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 } 213 222 } 214 223 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
r86077 r86322 209 209 void uninit() {} 210 210 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); 213 216 /** Unregisters event sources. */ 214 217 void unregisterSources();
Note:
See TracChangeset
for help on using the changeset viewer.