Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory:disconnect 問題 #354

Open
shewer opened this issue Jun 14, 2024 · 1 comment
Open

memory:disconnect 問題 #354

shewer opened this issue Jun 14, 2024 · 1 comment

Comments

@shewer
Copy link
Contributor

shewer commented Jun 14, 2024

@hcunhui 請教一下

我想改 disconnect 如下

void disconnect(an<T> t) {
    if (auto m = As<Memory>(t)){
       m->~Memory();
    }
 }

這樣可行嗎?
只有這樣才可在 Component.Translator 中使用字典的 translator 也可以清除 dict

@hchunhui
Copy link
Owner

直接调 destructor 可能有问题。因为 share pointer 计数归零的时候会再自动被调一次,可能会造成 crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants