Changeset 57364 in vbox
- Timestamp:
- Aug 14, 2015 5:28:03 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 102127
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
r55554 r57364 22 22 /* GUI includes: */ 23 23 # include "UIMainEventListener.h" 24 # include "VBoxGlobal.h" 24 25 25 26 /* COM includes: */ … … 67 68 STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent *pEvent) 68 69 { 70 /* Try to acquire COM cleanup protection token first: */ 71 if (!vboxGlobal().comTokenTryLockForRead()) 72 return S_OK; 73 69 74 CEvent event(pEvent); 70 75 // printf("Event received: %d\n", event.GetType()); … … 264 269 default: break; 265 270 } 271 272 /* Unlock COM cleanup protection token: */ 273 vboxGlobal().comTokenUnlock(); 274 266 275 return S_OK; 267 276 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r57099 r57364 4382 4382 mTypes.clear(); 4383 4383 4384 /* the last steps to ensure we don't use COM any more */ 4385 m_host.detach(); 4386 m_vbox.detach(); 4387 m_client.detach(); 4388 4389 /* There may be UIMedium(s)EnumeratedEvent instances still in the message 4390 * queue which reference COM objects. Remove them to release those objects 4391 * before uninitializing the COM subsystem. */ 4392 QApplication::removePostedEvents (this); 4393 4394 COMBase::CleanupCOM(); 4384 /* Starting COM cleanup: */ 4385 m_comCleanupProtectionToken.lockForWrite(); 4386 { 4387 /* First, make sure we don't use COM any more: */ 4388 m_host.detach(); 4389 m_vbox.detach(); 4390 m_client.detach(); 4391 4392 /* There may be UIMedium(s)EnumeratedEvent instances still in the message 4393 * queue which reference COM objects. Remove them to release those objects 4394 * before uninitializing the COM subsystem. */ 4395 QApplication::removePostedEvents(this); 4396 4397 /* Finally cleanup COM itself: */ 4398 COMBase::CleanupCOM(); 4399 } 4400 /* Finishing COM cleanup: */ 4401 m_comCleanupProtectionToken.unlock(); 4395 4402 4396 4403 /* Destroy popup-center: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r57099 r57364 120 120 #endif /* Q_WS_MAC */ 121 121 122 /** Try to acquire COM cleanup protection token for reading. */ 123 bool comTokenTryLockForRead() { return m_comCleanupProtectionToken.tryLockForRead(); } 124 /** Unlock previously acquired COM cleanup protection token. */ 125 void comTokenUnlock() { return m_comCleanupProtectionToken.unlock(); } 126 122 127 /** Returns the copy of VirtualBox client wrapper. */ 123 128 CVirtualBoxClient virtualBoxClient() const { return m_client; } … … 481 486 482 487 bool mValid; 488 489 /** COM cleanup protection token. */ 490 QReadWriteLock m_comCleanupProtectionToken; 483 491 484 492 /** Holds the instance of VirtualBox client wrapper. */
Note:
See TracChangeset
for help on using the changeset viewer.