mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
Fix idm remove
idm remove calls shared_ptr::exchange with a null_ptr. This calls the stored object's constructor with null args. Let's just add an exchange overload for null_ptr
This commit is contained in:
parent
439d665096
commit
915aa572c0
3 changed files with 18 additions and 4 deletions
|
@ -238,7 +238,7 @@ matching_ctx::matching_ctx(vm::ptr<SceNpId> npId, vm::ptr<SceNpMatchingHandler>
|
|||
this->handler = handler;
|
||||
this->arg = arg;
|
||||
}
|
||||
void matching_ctx::queue_callback(u32 req_id, s32 event, s32 error_code)
|
||||
void matching_ctx::queue_callback(u32 req_id, s32 event, s32 error_code) const
|
||||
{
|
||||
if (handler)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ void matching_ctx::queue_callback(u32 req_id, s32 event, s32 error_code)
|
|||
});
|
||||
}
|
||||
}
|
||||
void matching_ctx::queue_gui_callback(s32 event, s32 error_code)
|
||||
void matching_ctx::queue_gui_callback(s32 event, s32 error_code) const
|
||||
{
|
||||
if (gui_handler)
|
||||
{
|
||||
|
|
|
@ -289,8 +289,8 @@ struct matching_ctx
|
|||
{
|
||||
matching_ctx(vm::ptr<SceNpId> npid, vm::ptr<SceNpMatchingHandler> handler, vm::ptr<void> arg);
|
||||
|
||||
void queue_callback(u32 req_id, s32 event, s32 error_code);
|
||||
void queue_gui_callback(s32 event, s32 error_code);
|
||||
void queue_callback(u32 req_id, s32 event, s32 error_code) const;
|
||||
void queue_gui_callback(s32 event, s32 error_code) const;
|
||||
|
||||
static const u32 id_base = 0x9001;
|
||||
static const u32 id_step = 1;
|
||||
|
|
|
@ -895,6 +895,8 @@ namespace stx
|
|||
return value;
|
||||
}
|
||||
|
||||
[[nodiscard]] shared_type exchange(struct null_ptr_t) noexcept;
|
||||
|
||||
// Ineffective
|
||||
[[nodiscard]] bool compare_exchange(shared_type& cmp_and_old, shared_type exch)
|
||||
{
|
||||
|
@ -1141,6 +1143,18 @@ namespace stx
|
|||
}
|
||||
|
||||
} null_ptr;
|
||||
|
||||
template <typename T>
|
||||
atomic_ptr<T>::shared_type atomic_ptr<T>::exchange(null_ptr_t) noexcept
|
||||
{
|
||||
atomic_ptr old;
|
||||
old.m_val.raw() = m_val.exchange(0);
|
||||
old.m_val.raw() += 1;
|
||||
|
||||
shared_type result;
|
||||
result.m_ptr = std::launder(ptr_to(old.m_val));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Add table
Reference in a new issue