fix: remove a handle without fail other handles greater than the removed one #2016

Closed
wants to merge 1 commit into
from

1 participant

@ulion

currently, remove a handle will fail all other handles which greater than the removed one, this will happen when more than one plugindirectory script running within a overlapped time.
it's a obvious bug since the handle supposed not always be 0, there is possibility following example happens:

ui make a plugin dir listing request, which assigned handle 0:
plugin with handle 0 begin
json-rpc make another plugin dir listing request, which assigned handle 1:
plugin with handle 1 begin
plugin with handle 0 end, in the current code, the handle will be erased
plugin with handle 1 call function like setEndOfDirectory but handle 1 does not existed, the globalHandles vector size is 1 now the CPluginDirectory object with original handle 1 now on the handle 0 position, so the setEndOfDirectory call will failed, it's a mistake, this commit fix this problem.

@ulion ulion closed this Jan 2, 2013
@ulion ulion deleted the ulion:plugin_dir_handle_fix branch Jan 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment