cmdID should not be assigned in the cmd class constructor. Instead, assign cmdID after registering cmdtable by iterating through all commands in cmdtable #2686
Labels
☢️ Bug
Something isn't working
Is this a regression?
Yes
Description
cmdID的赋值,不应该这样塞在cmd类的构造函数里,应该在注册完cmdtable以后, 遍历一次cmdtable里的所有命令,逐个给一下cmdid
Please provide a link to a minimal reproduction of the bug
cmd_table_manager依赖于cmd对象, 结果他又让cmd类去依赖cmd_table_manager,循环引用为其1,2是会有并发问题,data race
Screenshots or videos
并发问题是这样:每次一旦有新的命令对象被构造(调用CMD的构造函数),就会调用一次
这里面会对cmdID++
如果有多个线程同时在new一个新的cmd对象
这个函数就会被并发调用,但是这个被++的cmdID,是个普通类型, 不能并发, 而且更重要的是cmdID这个东西,不应该说每次有命令对象产生了,就要++,每个不同的命令一个ID
Please provide the version you discovered this bug in (check about page for version information)
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: