Changeset 30071 in vbox
- Timestamp:
- Jun 7, 2010 1:29:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/GuestImpl.cpp
r30021 r30071 805 805 { 806 806 AssertPtr(pProgress); 807 uint32_t uNewContext = ASMAtomicIncU32(&mNextContextID);808 if (uNewContext == UINT32_MAX)809 ASMAtomicUoWriteU32(&mNextContextID, 1000);810 807 811 808 /** @todo Put this stuff into a constructor! */ 812 809 CallbackContext context; 813 context.mContextID = uNewContext;814 810 context.mType = enmType; 815 811 context.pvData = pvData; … … 817 813 context.pProgress = pProgress; 818 814 819 uint32_t nCallbacks; 820 { 815 /* Create a new context ID and assign it. */ 816 CallbackListIter it; 817 uint32_t uNewContext = 0; 818 do 819 { 820 /* Create a new context ID ... */ 821 uNewContext = ASMAtomicIncU32(&mNextContextID); 822 if (uNewContext == UINT32_MAX) 823 ASMAtomicUoWriteU32(&mNextContextID, 1000); 824 /* Is the context ID already used? */ 825 it = getCtrlCallbackContextByID(uNewContext); 826 } while(it != mCallbackList.end()); 827 828 uint32_t nCallbacks = 0; 829 if ( it == mCallbackList.end() 830 && uNewContext > 0) 831 { 832 /* We apparently got an unused context ID, let's use it! */ 833 context.mContextID = uNewContext; 821 834 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 822 /// @todo r=bird: check if already in the list and find another one.823 835 mCallbackList.push_back(context); 824 836 nCallbacks = mCallbackList.size(); 837 } 838 else 839 { 840 /* Should never happen ... */ 841 { 842 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 843 nCallbacks = mCallbackList.size(); 844 } 845 AssertReleaseMsg(uNewContext, ("No free context ID found! uNewContext=%u, nCallbacks=%u", uNewContext, nCallbacks)); 825 846 } 826 847 … … 911 932 AssertReturn(papszArgv, E_OUTOFMEMORY); 912 933 for (unsigned i = 0; RT_SUCCESS(vrc) && i < uNumArgs; i++) 913 { 914 /// @todo r=bird: RTUtf16ToUtf8(). 915 int cbLen = RTStrAPrintf(&papszArgv[i], "%s", Utf8Str(args[i]).raw()); 916 if (cbLen < 0) 917 vrc = VERR_NO_MEMORY; 918 919 } 934 vrc = RTUtf16ToUtf8(args[i], &papszArgv[i]); 920 935 papszArgv[uNumArgs] = NULL; 921 936 }
Note:
See TracChangeset
for help on using the changeset viewer.