Changeset 77096 in vbox
- Timestamp:
- Feb 1, 2019 9:14:03 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r77095 r77096 1036 1036 if (itGroup != mWaitEventGroups.end()) 1037 1037 { 1038 #if 1 /** @todo r=bird: consider the other variant. */1039 GuestWaitEvents::iterator itEvents = itGroup->second.begin();1040 while (itEvents != itGroup->second.end())1041 {1042 #ifdef DEBUG1043 LogFlowThisFunc(("Signalling event=%p, type=%ld (CID %RU32: Session=%RU32, Object=%RU32, Count=%RU32) ...\n",1044 itEvents->second, aType, itEvents->first,1045 VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(itEvents->first),1046 VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(itEvents->first),1047 VBOX_GUESTCTRL_CONTEXTID_GET_COUNT(itEvents->first)));1048 #endif1049 ComPtr<IEvent> pThisEvent = aEvent; /** @todo r=bird: This means addref/release for each iteration. Isn't that silly? */1050 Assert(!pThisEvent.isNull());1051 int rc2 = itEvents->second->SignalExternal(aEvent);1052 if (RT_SUCCESS(rc))1053 rc = rc2; /** @todo r=bird: This doesn't make much sense since it will only fail if not1054 * properly initialized or major memory corruption. And if it's broken, why1055 * don't you just remove it instead of leaving it in the group??? It would1056 * make life so much easier here as you could just change the while condition1057 * to while ((itEvents = itGroup->second.begin() != itGroup->second.end())1058 * and skip all this two step removal below. I'll put this in a #if 0 and show what I mean... */1059 1060 if (RT_SUCCESS(rc2))1061 {1062 /** @todo r=bird: I don't follow the logic here. Why don't you just remove1063 * it from all groups, including this one? You just have move the */1064 1065 /* Remove the event from all other event groups (except the1066 * original one!) because it was signalled. */1067 AssertPtr(itEvents->second);1068 const GuestEventTypes evTypes = itEvents->second->Types();1069 for (GuestEventTypes::const_iterator itType = evTypes.begin();1070 itType != evTypes.end(); ++itType)1071 {1072 if ((*itType) != aType) /* Only remove all other groups. */1073 {1074 /* Get current event group. */1075 GuestEventGroup::iterator evGroup = mWaitEventGroups.find((*itType));1076 Assert(evGroup != mWaitEventGroups.end());1077 1078 /* Lookup event in event group. */1079 GuestWaitEvents::iterator evEvent = evGroup->second.find(itEvents->first /* Context ID */);1080 Assert(evEvent != evGroup->second.end());1081 1082 LogFlowThisFunc(("Removing event=%p (type %ld)\n", evEvent->second, (*itType)));1083 evGroup->second.erase(evEvent);1084 1085 LogFlowThisFunc(("%zu events for type=%ld left\n",1086 evGroup->second.size(), aType));1087 }1088 }1089 1090 /* Remove the event from the passed-in event group. */1091 GuestWaitEvents::iterator itEventsNext = itEvents;1092 ++itEventsNext;1093 itGroup->second.erase(itEvents);1094 itEvents = itEventsNext;1095 }1096 else1097 ++itEvents;1098 #ifdef DEBUG1099 cEvents++;1100 #endif1101 }1102 #else1103 1038 /* Signal all events in the group, leaving the group empty afterwards. */ 1104 1039 GuestWaitEvents::iterator ItWaitEvt; … … 1133 1068 } 1134 1069 } 1135 #endif1136 1070 } 1137 1071
Note:
See TracChangeset
for help on using the changeset viewer.