Fix DialogBrowse crashing when deleting the last item nullptr. In iOS use std::recursive_mutex instead of the custom check.
This commit is contained in:
@@ -47,6 +47,8 @@ void NodeDialogBrowse::init_controls()
|
||||
msgbox->btn_ok->on_click = [this,msgbox](Node*){
|
||||
auto path = current->m_path;
|
||||
int idx = container->get_child_index(current);
|
||||
if (auto image_tex = current->find<NodeImageTexture>("thumb-tex"))
|
||||
image_tex->tex.destroy();
|
||||
container->remove_child(current);
|
||||
if (!container->m_children.empty())
|
||||
{
|
||||
@@ -59,8 +61,6 @@ void NodeDialogBrowse::init_controls()
|
||||
else
|
||||
{
|
||||
current = nullptr;
|
||||
auto image_tex = find<NodeImageTexture>("thumb-tex");
|
||||
image_tex->tex.destroy();
|
||||
}
|
||||
Asset::delete_file(path);
|
||||
msgbox->destroy();
|
||||
@@ -94,10 +94,11 @@ void NodeDialogBrowse::init_controls()
|
||||
};
|
||||
|
||||
// load thumb
|
||||
auto image_tex = node->find<NodeImageTexture>("thumb-tex");
|
||||
image_tex->tex.destroy();
|
||||
image_tex->tex.create(thumb);
|
||||
|
||||
if (auto image_tex = node->find<NodeImageTexture>("thumb-tex"))
|
||||
{
|
||||
image_tex->tex.destroy();
|
||||
image_tex->tex.create(thumb);
|
||||
}
|
||||
container->add_child(node);
|
||||
}
|
||||
// if (auto* first = (NodeDialogBrowseItem*)container->get_child_at(0))
|
||||
|
||||
Reference in New Issue
Block a user