cellAudio: weak_ptr -> shared_ptr

This commit is contained in:
Eladash 2021-05-14 15:18:30 +03:00 committed by Ivan
parent 94e2f464e3
commit a992a5fba9
2 changed files with 5 additions and 7 deletions

View File

@ -505,7 +505,7 @@ void cell_audio_thread::advance(u64 timestamp, bool reset)
continue; continue;
} }
if ((queues[queue_count] = key_inf.port.lock())) if ((queues[queue_count] = key_inf.port))
{ {
u32 periods = 1; 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 for (auto i = g_audio.keys.cbegin(); i != g_audio.keys.cend();) // check for duplicates
{ {
auto port = i->port.lock(); if (i->port == q)
if (port == q)
{ {
return CELL_AUDIO_ERROR_TRANS_EVENT; 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 // Cleanup, avoid cases where there are multiple ports with the same key
i = g_audio.keys.erase(i); 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++) 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) if (i->flags != iFlags)
{ {

View File

@ -383,7 +383,7 @@ public:
u8 start_period; // Starting event_period u8 start_period; // Starting event_period
u32 flags; // iFlags u32 flags; // iFlags
u64 source; // Event source u64 source; // Event source
std::weak_ptr<lv2_event_queue> port; // Underlying event port std::shared_ptr<lv2_event_queue> port; // Underlying event port
}; };
std::vector<key_info> keys; std::vector<key_info> keys;