pubnub / swift

PubNub native Swift SDK for iOS, MacOS, WatchOS, TvOS
Other
31 stars 28 forks source link

Fatal error on `WeakBox<BaseSubscriptionListener>` #173

Closed akuzminskyi closed 2 weeks ago

akuzminskyi commented 6 months ago
Duplicate elements of type 'WeakBox<BaseSubscriptionListener>' were found in a Set.

SCR-20240514-eln

Screenshot 2024-05-14 at 11 23 09

Maybe this post can help.

PubNub SDK Version 6.2.3(yes, this is not the latest).

jguz-pubnub commented 6 months ago

@akuzminskyi could you show how you add listeners to the PubNub instance? And how do you store SubscriptionListener variables? Are they strong references?

akuzminskyi commented 6 months ago

Are they strong references?

yes, and I think maybe the same listener can be trying to add twice.

if this is the case, shouldn't we ignore it and instead of:

elements.update(with: WeakBox(element))
elements.insert(WeakBox(element))
akuzminskyi commented 4 months ago

I think the issue is described here. so I think this issue is with the SDK implementation.

jguz-pubnub commented 4 months ago

I was unable to reproduce this error on 6.2.3 when attempting to add the same listener more than once. I will investigate possible new scenarios and update you on my findings in this thread

jguz-pubnub commented 2 weeks ago

Fixed in 7.3.3