diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index ecd410ae4b..686ca86ded 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -505,7 +505,7 @@ void cell_audio_thread::advance(u64 timestamp, bool reset) continue; } - if ((queues[queue_count] = key_inf.port.lock())) + if ((queues[queue_count] = key_inf.port)) { u32 periods = 1; @@ -1570,14 +1570,12 @@ error_code AudioSetNotifyEventQueue(u64 key, u32 iFlags) for (auto i = g_audio.keys.cbegin(); i != g_audio.keys.cend();) // check for duplicates { - auto port = i->port.lock(); - - if (port == q) + if (i->port == q) { return CELL_AUDIO_ERROR_TRANS_EVENT; } - if (!lv2_event_queue::check(port)) + if (!lv2_event_queue::check(i->port)) { // Cleanup, avoid cases where there are multiple ports with the same key i = g_audio.keys.erase(i); @@ -1627,7 +1625,7 @@ error_code AudioRemoveNotifyEventQueue(u64 key, u32 iFlags) for (auto i = g_audio.keys.cbegin(); i != g_audio.keys.cend(); i++) { - if ([&](auto port){ return lv2_event_queue::check(port) && port->key == key; }(i->port.lock())) + if (lv2_event_queue::check(i->port) && i->port->key == key) { if (i->flags != iFlags) { diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.h b/rpcs3/Emu/Cell/Modules/cellAudio.h index 8481fdea2f..d18f3094af 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.h +++ b/rpcs3/Emu/Cell/Modules/cellAudio.h @@ -383,7 +383,7 @@ public: u8 start_period; // Starting event_period u32 flags; // iFlags u64 source; // Event source - std::weak_ptr port; // Underlying event port + std::shared_ptr port; // Underlying event port }; std::vector keys;