Merge pull request #9 from LeetCode-OpenSource/fix_memory_leaks
Fix memory leaks in LspEndpoint
This commit is contained in:
commit
b6d7378121
@ -88,11 +88,14 @@ class LspEndpoint(threading.Thread):
|
||||
self.next_id += 1
|
||||
cond = threading.Condition()
|
||||
self.event_dict[current_id] = cond
|
||||
|
||||
cond.acquire()
|
||||
self.send_message(method_name, kwargs, current_id)
|
||||
cond.wait()
|
||||
cond.release()
|
||||
result, error = self.response_dict[current_id]
|
||||
|
||||
self.event_dict.pop(current_id)
|
||||
result, error = self.response_dict.pop(current_id)
|
||||
if error:
|
||||
raise lsp_structs.ResponseError(error.get("code"), error.get("message"), error.get("data"))
|
||||
return result
|
||||
|
Loading…
Reference in New Issue
Block a user