Changeset 60223 in vbox
- Timestamp:
- Mar 28, 2016 3:13:10 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r60222 r60223 43 43 { 44 44 if (!m_spInstance) 45 {46 45 m_spInstance = new UIConsoleEventHandler(pSession); 47 m_spInstance->prepare();48 }49 46 } 50 47 … … 54 51 if (m_spInstance) 55 52 { 56 m_spInstance->cleanup();57 53 delete m_spInstance; 58 54 m_spInstance = 0; … … 86 82 : m_pSession(pSession) 87 83 { 84 /* Prepare: */ 85 prepare(); 86 } 87 88 UIConsoleEventHandler::~UIConsoleEventHandler() 89 { 90 /* Cleanup: */ 91 cleanup(); 88 92 } 89 93 … … 176 180 this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)), 177 181 Qt::QueuedConnection); 178 179 182 connect(pListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)), 180 183 this, SIGNAL(sigRuntimeError(bool, QString, QString)), … … 182 185 183 186 /* Create direct (sync) connections for waitable signals: */ 184 connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool &, QString&)),185 this, SLOT(sltCanShowWindow(bool &, QString&)),187 connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool &, QString &)), 188 this, SLOT(sltCanShowWindow(bool &, QString &)), 186 189 Qt::DirectConnection); 187 connect(pListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)),188 this, SLOT(sltShowWindow(qint64 &)),190 connect(pListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)), 191 this, SLOT(sltShowWindow(qint64 &)), 189 192 Qt::DirectConnection); 190 193 } … … 192 195 void UIConsoleEventHandler::cleanup() 193 196 { 197 /* Make sure session is passed: */ 198 AssertPtrReturnVoid(m_pSession); 199 194 200 /* Get console: */ 195 201 const CConsole console = m_pSession->session().GetConsole(); … … 198 204 /* Get event-source: */ 199 205 CEventSource eventSource = console.GetEventSource(); 200 Assert ReturnVoid(!eventSource.isNull() || eventSource.isOk());206 AssertWrapperOk(eventSource); 201 207 /* Unregister listener: */ 202 208 eventSource.UnregisterListener(m_mainEventListener); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
r60222 r60223 36 36 /** Singleton QObject extension 37 37 * providing GUI with the CConsole event-source. */ 38 class UIConsoleEventHandler : public QObject38 class UIConsoleEventHandler : public QObject 39 39 { 40 40 Q_OBJECT; … … 99 99 /** Constructs console event handler for passed @a pSession. */ 100 100 UIConsoleEventHandler(UISession *pSession); 101 /** Destructs console event handler. */ 102 ~UIConsoleEventHandler(); 101 103 102 104 /** Prepares all. */ … … 108 110 static UIConsoleEventHandler *m_spInstance; 109 111 112 /** Holds the COM event listener instance. */ 113 CEventListener m_mainEventListener; 114 110 115 /** Holds the UI session reference. */ 111 116 UISession *m_pSession; 112 113 /** Holds the main event listener instance. */114 CEventListener m_mainEventListener;115 117 }; 116 118 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
r60222 r60223 32 32 33 33 /* static */ 34 UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_ pInstance = 0;34 UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_spInstance = 0; 35 35 36 36 /* static */ 37 37 UIVirtualBoxEventHandler* UIVirtualBoxEventHandler::instance() 38 38 { 39 if (!m_ pInstance)40 m_ pInstance = new UIVirtualBoxEventHandler;41 return m_ pInstance;39 if (!m_spInstance) 40 m_spInstance = new UIVirtualBoxEventHandler; 41 return m_spInstance; 42 42 } 43 43 … … 45 45 void UIVirtualBoxEventHandler::destroy() 46 46 { 47 if (m_ pInstance)47 if (m_spInstance) 48 48 { 49 delete m_ pInstance;50 m_ pInstance = 0;49 delete m_spInstance; 50 m_spInstance = 0; 51 51 } 52 52 } 53 53 54 54 UIVirtualBoxEventHandler::UIVirtualBoxEventHandler() 55 { 56 /* Prepare: */ 57 prepare(); 58 } 59 60 UIVirtualBoxEventHandler::~UIVirtualBoxEventHandler() 61 { 62 /* Cleanup: */ 63 cleanup(); 64 } 65 66 void UIVirtualBoxEventHandler::prepare() 55 67 { 56 68 /* Create Main event listener instance: */ … … 124 136 } 125 137 126 UIVirtualBoxEventHandler::~UIVirtualBoxEventHandler()138 void UIVirtualBoxEventHandler::cleanup() 127 139 { 128 140 /* Get VirtualBox: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
r60222 r60223 69 69 ~UIVirtualBoxEventHandler(); 70 70 71 /** Prepares all. */ 72 void prepare(); 73 /** Cleanups all. */ 74 void cleanup(); 75 71 76 /** Holds the singleton static VirtualBox event handler instance. */ 72 static UIVirtualBoxEventHandler *m_ pInstance;77 static UIVirtualBoxEventHandler *m_spInstance; 73 78 74 79 /** Holds the COM event listener instance. */
Note:
See TracChangeset
for help on using the changeset viewer.