Changeset 65361 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 18, 2017 1:14:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r65247 r65361 5 5 6 6 /* 7 * Copyright (C) 2004-201 6Oracle Corporation7 * Copyright (C) 2004-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 234 234 RTCritSectEnter(&sLock); 235 235 236 nsrefcnt count = 0;236 nsrefcnt count = 1; 237 237 238 238 /* sInstance is NULL here if it was deleted immediately after … … 240 240 if (sInstance != NULL) 241 241 { 242 /* Release the guard reference added in GetInstance() */ 242 /* Safe way to get current refcount is by first increasing and 243 * then decreasing. Keep in mind that the Release is overloaded 244 * (see VirtualBoxClassFactory::Release) and will start the 245 * timer again if the returned count is 1. It won't do harm, 246 * but also serves no purpose, so stop it ASAP. */ 247 sInstance->AddRef(); 243 248 count = sInstance->Release(); 244 } 245 246 if (count == 0) 249 if (count == 1) 250 { 251 RTTimerLRStop(sTimer); 252 /* Release the guard reference added in GetInstance() */ 253 sInstance->Release(); 254 } 255 } 256 257 if (count == 1) 247 258 { 248 259 if (gAutoShutdown || m_fSignal) … … 262 273 * but before it started to process it. */ 263 274 LogRel(("Destruction is canceled (refcnt=%d).\n", count)); 264 /* Important: restore previous refcount, we decreased it265 * above based on the assumption that the object is unused! */266 sInstance->AddRef();267 275 } 268 276 … … 408 416 Assert(count > 1); 409 417 410 if (count == 2)418 if (count >= 2) 411 419 { 412 420 LogFlowFunc(("Another client has requested a reference to VirtualBox, canceling destruction...\n"));
Note:
See TracChangeset
for help on using the changeset viewer.