Running method while destroying the object

前端 未结 8 1585
抹茶落季
抹茶落季 2021-01-12 22:49

A few days ago my friend told me about the situation, they had in their project. Someone decided, that it would be good to destroy the object of NotVerySafeClass

8条回答
  •  无人及你
    2021-01-12 23:30

    There is no methods that can be used to prevent this scenario.

    In multithread programming, you need to make sure that an object will not be deleted if there are some others thread still accessing it.

    If you are dealing with such code, it needs fundamental fix

提交回复
热议问题