- Timestamp:
- Jan 26, 2011 4:37:16 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r35446 r35722 99 99 100 100 virtual ~VirtualBoxClientEventListener() 101 { 102 } 103 104 HRESULT init() 105 { 106 return S_OK; 107 } 108 109 void uninit() 101 110 { 102 111 } … … 145 154 146 155 virtual ~VirtualBoxEventListener() 156 { 157 } 158 159 HRESULT init() 160 { 161 return S_OK; 162 } 163 164 void uninit() 147 165 { 148 166 } … … 252 270 253 271 virtual ~ConsoleEventListener() 272 { 273 } 274 275 HRESULT init() 276 { 277 return S_OK; 278 } 279 280 void uninit() 254 281 { 255 282 } … … 763 790 ComPtr<IMachine> machine; 764 791 bool fSessionOpened = false; 765 IEventListener *vboxClientListener = NULL;766 IEventListener *vboxListener = NULL;767 Co nsoleEventListenerImpl *consoleListener = NULL;792 ComPtr<IEventListener> vboxClientListener; 793 ComPtr<IEventListener> vboxListener; 794 ComObjPtr<ConsoleEventListenerImpl> consoleListener; 768 795 769 796 do … … 1001 1028 ComPtr<IEventSource> pES; 1002 1029 CHECK_ERROR(pVirtualBoxClient, COMGETTER(EventSource)(pES.asOutParam())); 1003 vboxClientListener = new VirtualBoxClientEventListenerImpl(); 1030 ComObjPtr<VirtualBoxClientEventListenerImpl> listener; 1031 listener.createObject(); 1032 listener->init(new VirtualBoxClientEventListener()); 1033 vboxClientListener = listener; 1004 1034 com::SafeArray<VBoxEventType_T> eventTypes; 1005 1035 eventTypes.push_back(VBoxEventType_OnVBoxSVCAvailabilityChanged); … … 1011 1041 ComPtr<IEventSource> es; 1012 1042 CHECK_ERROR(console, COMGETTER(EventSource)(es.asOutParam())); 1013 consoleListener = new ConsoleEventListenerImpl(); 1043 consoleListener.createObject(); 1044 consoleListener->init(new ConsoleEventListener()); 1014 1045 com::SafeArray<VBoxEventType_T> eventTypes; 1015 1046 eventTypes.push_back(VBoxEventType_OnMouseCapabilityChanged); … … 1166 1197 ComPtr<IEventSource> es; 1167 1198 CHECK_ERROR(virtualBox, COMGETTER(EventSource)(es.asOutParam())); 1168 vboxListener = new VirtualBoxEventListenerImpl(); 1199 ComObjPtr<VirtualBoxEventListenerImpl> listener; 1200 listener.createObject(); 1201 listener->init(new VirtualBoxEventListener()); 1202 vboxListener = listener; 1169 1203 com::SafeArray<VBoxEventType_T> eventTypes; 1170 1204 eventTypes.push_back(VBoxEventType_OnGuestPropertyChanged); -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r35666 r35722 245 245 } 246 246 247 HRESULT init() 248 { 249 return S_OK; 250 } 251 252 void uninit() 253 { 254 } 255 247 256 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent * aEvent) 248 257 { … … 287 296 288 297 virtual ~VBoxSDLEventListener() 298 { 299 } 300 301 HRESULT init() 302 { 303 return S_OK; 304 } 305 306 void uninit() 289 307 { 290 308 } … … 347 365 348 366 virtual ~VBoxSDLConsoleEventListener() 367 { 368 } 369 370 HRESULT init() 371 { 372 return S_OK; 373 } 374 375 void uninit() 349 376 { 350 377 } … … 772 799 uint32_t memorySize = 0; 773 800 uint32_t vramSize = 0; 774 IEventListener *pVBoxClientListener = NULL;775 IEventListener *pVBoxListener = NULL;776 VBoxSDLConsoleEventListenerImpl *pConsoleListener = NULL;801 ComPtr<IEventListener> pVBoxClientListener; 802 ComPtr<IEventListener> pVBoxListener; 803 ComObjPtr<VBoxSDLConsoleEventListenerImpl> pConsoleListener; 777 804 778 805 bool fFullscreen = false; … … 1834 1861 ComPtr<IEventSource> pES; 1835 1862 CHECK_ERROR(pVirtualBoxClient, COMGETTER(EventSource)(pES.asOutParam())); 1836 pVBoxClientListener = new VBoxSDLClientEventListenerImpl(); 1863 ComObjPtr<VBoxSDLClientEventListenerImpl> listener; 1864 listener.createObject(); 1865 listener->init(new VBoxSDLClientEventListener()); 1866 pVBoxClientListener = listener; 1837 1867 com::SafeArray<VBoxEventType_T> eventTypes; 1838 1868 eventTypes.push_back(VBoxEventType_OnVBoxSVCAvailabilityChanged); … … 1844 1874 ComPtr<IEventSource> pES; 1845 1875 CHECK_ERROR(pVirtualBox, COMGETTER(EventSource)(pES.asOutParam())); 1846 pVBoxListener = new VBoxSDLEventListenerImpl(); 1876 ComObjPtr<VBoxSDLEventListenerImpl> listener; 1877 listener.createObject(); 1878 listener->init(new VBoxSDLEventListener()); 1879 pVBoxListener = listener; 1847 1880 com::SafeArray<VBoxEventType_T> eventTypes; 1848 1881 eventTypes.push_back(VBoxEventType_OnExtraDataChanged); … … 1854 1887 ComPtr<IEventSource> pES; 1855 1888 CHECK_ERROR(gpConsole, COMGETTER(EventSource)(pES.asOutParam())); 1856 pConsoleListener = new VBoxSDLConsoleEventListenerImpl(); 1889 pConsoleListener.createObject(); 1890 pConsoleListener->init(new VBoxSDLConsoleEventListener()); 1857 1891 com::SafeArray<VBoxEventType_T> eventTypes; 1858 1892 eventTypes.push_back(VBoxEventType_OnMousePointerShapeChanged); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp
r34527 r35722 252 252 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 253 253 const CVirtualBox &vbox = vboxGlobal().virtualBox(); 254 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 254 ComObjPtr<UIMainEventListenerImpl> pListener; 255 pListener.createObject(); 256 pListener->init(new UIMainEventListener(), this); 255 257 m_mainEventListener = CEventListener(pListener); 256 258 QVector<KVBoxEventType> events; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r34527 r35722 25 25 //#include <iprt/stream.h> 26 26 27 UIMainEventListener::UIMainEventListener(QObject * /* pParent */) 28 // : QObject(pParent) /* Todo: Not sure if pParent should delete this. Especially on Win there is ref counting implemented. */ 27 UIMainEventListener::UIMainEventListener() 29 28 : QObject() 30 29 { … … 42 41 } 43 42 43 HRESULT UIMainEventListener::init(QObject * /* pParent */) 44 { 45 return S_OK; 46 } 47 48 void UIMainEventListener::uninit() 49 { 50 } 44 51 45 52 /** … … 50 57 { 51 58 CEvent event(pEvent); 52 // RTPrintf("Event received: %d (%RTthrd)\n", event.GetType(), RTThreadSelf());59 // printf("Event received: %d\n", event.GetType()); 53 60 switch(event.GetType()) 54 61 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
r34527 r35722 43 43 44 44 public: 45 UIMainEventListener(QObject *pParent); 45 UIMainEventListener(); 46 47 48 HRESULT init(QObject *pParent); 49 void uninit(); 46 50 47 51 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r35665 r35722 5249 5249 QApplication::removePostedEvents (this); 5250 5250 5251 #ifdef Q_WS_WIN5252 /* COM for the main thread is shutdown in main() */5253 #else5254 5251 COMBase::CleanupCOM(); 5255 #endif5256 5252 5257 5253 mValid = false; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
r34527 r35722 59 59 60 60 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 61 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 61 ComObjPtr<UIMainEventListenerImpl> pListener; 62 pListener.createObject(); 63 pListener->init(new UIMainEventListener(), this); 62 64 m_mainEventListener = CEventListener(pListener); 63 65 QVector<KVBoxEventType> events; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
r34527 r35722 52 52 // RTPrintf("Self add: %RTthrd\n", RTThreadSelf()); 53 53 const CVirtualBox &vbox = vboxGlobal().virtualBox(); 54 UIMainEventListenerImpl *pListener = new UIMainEventListenerImpl(this); 54 ComObjPtr<UIMainEventListenerImpl> pListener; 55 pListener.createObject(); 56 pListener->init(new UIMainEventListener(), this); 55 57 m_mainEventListener = CEventListener(pListener); 56 58 QVector<KVBoxEventType> events; -
trunk/src/VBox/Main/include/ConsoleImpl.h
r35638 r35722 754 754 } 755 755 mCallbackData; 756 C OM_STRUCT_OR_CLASS(IEventListener) *mVmListener;756 ComPtr<IEventListener> mVmListener; 757 757 758 758 friend struct VMTask; -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r35638 r35722 175 175 IFramebuffer *maFramebuffers[SchemaDefs::MaxGuestMonitors]; 176 176 177 IEventListener *mConsoleListener;177 ComPtr<IEventListener> mConsoleListener; 178 178 179 179 VRDPInputSynch m_InputSynch; -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r35638 r35722 646 646 { 647 647 #ifdef RT_OS_WINDOWS 648 return 649 648 return CoCreateFreeThreadedMarshaler(this, //GetControllingUnknown(), 649 &m_pUnkMarshaler.p); 650 650 #else 651 651 return S_OK; -
trunk/src/VBox/Main/src-all/EventImpl.cpp
r35638 r35722 804 804 aAlock.release(); 805 805 rc = mListener->HandleEvent(aEvent); 806 #ifdef RT_OS_WINDOWS 807 Assert(rc != RPC_E_WRONG_THREAD); 808 #endif 806 809 aAlock.acquire(); 807 810 } -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r35676 r35722 266 266 class VmEventListener { 267 267 public: 268 VmEventListener(Console *aConsole) 268 VmEventListener() 269 {} 270 271 272 HRESULT init(Console *aConsole) 269 273 { 270 274 mConsole = aConsole; 275 return S_OK; 276 } 277 278 void uninit() 279 { 271 280 } 272 281 … … 495 504 rc = pVirtualBox->COMGETTER(EventSource)(pES.asOutParam()); 496 505 AssertComRC(rc); 497 mVmListener = new VmEventListenerImpl(this); 506 ComObjPtr<VmEventListenerImpl> aVmListener; 507 aVmListener.createObject(); 508 aVmListener->init(new VmEventListener(), this); 509 mVmListener = aVmListener; 498 510 com::SafeArray<VBoxEventType_T> eventTypes; 499 511 eventTypes.push_back(VBoxEventType_OnNATRedirect); 500 512 eventTypes.push_back(VBoxEventType_OnHostPciDevicePlug); 501 rc = pES->RegisterListener( mVmListener, ComSafeArrayAsInParam(eventTypes), true);513 rc = pES->RegisterListener(aVmListener, ComSafeArrayAsInParam(eventTypes), true); 502 514 AssertComRC(rc); 503 515 } … … 548 560 { 549 561 rc = pES->UnregisterListener(mVmListener); 550 // XXX: for some reasons we're getting VBOX_E_OBJECT_NOT_FOUND 551 // here - investigate 552 //AssertComRC(rc); 562 AssertComRC(rc); 553 563 } 554 564 } 555 mVmListener->Release(); 556 mVmListener = 0; 565 mVmListener.setNull(); 557 566 } 558 567 -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r35638 r35722 44 44 { 45 45 public: 46 VRDPConsoleListener(ConsoleVRDPServer *server) 47 : m_server(server) 46 VRDPConsoleListener() 47 { 48 } 49 50 HRESULT init(ConsoleVRDPServer *server) 51 { 52 m_server = server; 53 return S_OK; 54 } 55 56 void uninit() 48 57 { 49 58 } … … 1290 1299 ComPtr<IEventSource> es; 1291 1300 console->COMGETTER(EventSource)(es.asOutParam()); 1292 mConsoleListener = new VRDPConsoleListenerImpl(this); 1301 ComObjPtr<VRDPConsoleListenerImpl> aConsoleListener; 1302 aConsoleListener.createObject(); 1303 aConsoleListener->init(new VRDPConsoleListener(), this); 1304 mConsoleListener = aConsoleListener; 1293 1305 com::SafeArray <VBoxEventType_T> eventTypes; 1294 1306 eventTypes.push_back(VBoxEventType_OnMousePointerShapeChanged); … … 1314 1326 mConsole->COMGETTER(EventSource)(es.asOutParam()); 1315 1327 es->UnregisterListener(mConsoleListener); 1316 mConsoleListener->Release(); 1317 mConsoleListener = NULL; 1328 mConsoleListener.setNull(); 1318 1329 } 1319 1330 -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r35638 r35722 4392 4392 4393 4393 AssertReturn(pvUser, VERR_INVALID_POINTER); 4394 4395 com::Initialize(); 4394 4396 4395 4397 // create an event queue for the current thread … … 4406 4408 4407 4409 delete eventQ; 4410 4411 com::Shutdown(); 4412 4408 4413 4409 4414 LogFlowFuncLeave(); -
trunk/src/VBox/Main/src-server/win/svcmain.cpp
r35368 r35722 20 20 #include "VBox/com/defs.h" 21 21 22 #include "VBox/com/com.h" 23 22 24 #include "VBox/com/VirtualBox.h" 23 25 … … 157 159 lpCmdLine = GetCommandLine(); /* this line necessary for _ATL_MIN_CRT */ 158 160 159 #if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED) 160 HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); 161 #else 162 HRESULT hRes = CoInitialize(NULL); 163 #endif 161 HRESULT hRes = com::Initialize(); 162 164 163 _ASSERTE(SUCCEEDED(hRes)); 165 164 _Module.Init(ObjectMap, hInstance, &LIBID_VirtualBox); … … 277 276 278 277 _Module.Term(); 279 CoUninitialize(); 278 279 com::Shutdown(); 280 280 281 Log(("SVCMAIN: Returning, COM server process ends.\n")); 281 282 return nRet; -
trunk/src/VBox/Main/webservice/vboxweb.cpp
r35571 r35722 501 501 { 502 502 } 503 504 HRESULT init() 505 { 506 return S_OK; 507 } 508 509 void uninit() 510 { 511 } 512 503 513 504 514 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent) … … 921 931 922 932 /* VirtualBoxClient events registration. */ 923 IEventListener *vboxClientListener = NULL;933 ComPtr<IEventListener> vboxClientListener; 924 934 { 925 935 ComPtr<IEventSource> pES; 926 936 CHECK_ERROR(g_pVirtualBoxClient, COMGETTER(EventSource)(pES.asOutParam())); 927 vboxClientListener = new VirtualBoxClientEventListenerImpl(); 937 ComObjPtr<VirtualBoxClientEventListenerImpl> clientListener; 938 clientListener.createObject(); 939 clientListener->init(new VirtualBoxClientEventListener()); 940 vboxClientListener = clientListener; 928 941 com::SafeArray<VBoxEventType_T> eventTypes; 929 942 eventTypes.push_back(VBoxEventType_OnVBoxSVCAvailabilityChanged);
Note:
See TracChangeset
for help on using the changeset viewer.