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

Typemap: Set init to false after each individual destructor #14931

Merged
merged 1 commit into from Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion rpcs3/util/auto_typemap.hpp
Expand Up @@ -135,7 +135,12 @@ namespace stx
// Destroy objects in reverse order
for (; _max; _max--)
{
(*--m_info)->destroy(*--m_order);
auto* info = *--m_info;
const u32 type_index = static_cast<const type_info<typeinfo>*>(info)->index();
info->destroy(*--m_order);

// Set init to false. We don't want other fxo to use this fxo in their destructor.
m_init[type_index] = false;
}

// Pointers should be restored to their positions
Expand Down
7 changes: 6 additions & 1 deletion rpcs3/util/fixed_typemap.hpp
Expand Up @@ -313,7 +313,12 @@ namespace stx
// Destroy objects in reverse order
for (; _max; _max--)
{
(*--m_info)->destroy(*--m_order);
auto* info = *--m_info;
const u32 type_index = static_cast<const type_info<typeinfo>*>(info)->index();
info->destroy(*--m_order);

// Set init to false. We don't want other fxo to use this fxo in their destructor.
m_init[type_index] = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it in info->destroy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the same object?

Copy link
Contributor

@elad335 elad335 Dec 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, move this line to typeinfo::call_dtor. You can cast it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a static function...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then pass it as argument or smth

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And do it in auto_typemap.hpp too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but I don't have the time to make this code even more spaghetti-like

}

// Pointers should be restored to their positions
Expand Down