释放 Glib::RefPtr

发布于 2024-10-07 02:50:50 字数 155 浏览 0 评论 0原文

使用完指针sourceImage后如何释放它。

Glib::RefPtr<Gdk::Pixbuf> sourceImage = Gdk::Pixbuf::create_from_file(inSourcePath.c_str());

How can i release the pointer sourceImage after finishing using it.

Glib::RefPtr<Gdk::Pixbuf> sourceImage = Gdk::Pixbuf::create_from_file(inSourcePath.c_str());

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青衫负雪 2024-10-14 02:50:50

如前所述,您不需要释放它。只要让RefPtr超出范围,它就会自动释放。但是,如果由于某种原因您确实想要手动释放它,您可以简单地调用sourceImage.reset()

As mentioned, you don't need to release it. Just let the RefPtr go out of scope and it will be released automatically. However, if for some reason you do want to release it manually, you can simply call sourceImage.reset()

欲拥i 2024-10-14 02:50:50

释放它。

当[object]超出范围时,unref()
将会在后台发生,而你
不用再担心了。
没有新的,所以没有删除。

You don't release it.

When [object] goes out of scope an unref()
will happen in the background and you
don't need to worry about it anymore.
There's no new so there's no delete.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文