libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
224 stars 83 forks source link

Gdx-pay iOS Robovm crash #158

Closed keesvandieren closed 7 years ago

keesvandieren commented 7 years ago

Sometimes we have this crash on iOS apps: https://pastebin.com/G9FB52DW

" Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x2212002d005c05ab "

Relevant parts of discussion on Robovm Gitter chat:

I might have found it. addStrongRef should be used when setting / adding a Delegate / Observer / Event Listener whose property / setter name is not delegate / setDelegate.

According to this Google group post: https://groups.google.com/forum/#!topic/robovm/fHLriJ2_j5Y

Gdx-pay adds an observer here: https://github.com/libgdx/gdx-pay/blob/master/gdx-pay-iosrobovm-apple/src/main/java/com/badlogic/gdx/pay/ios/apple/PurchaseManageriOSApple.java#L322

So on line 323 we should add:

defaultQueue.addStrongRef(appleObserver);

And line 142 (in dispose() method) we should update like so:

    SKPaymentQueue defaultQueue = SKPaymentQueue.getDefaultQueue();
    defaultQueue.removeTransactionObserver(appleObserver);
    defaultQueue.removeStrongRef(appleObserver);
keesvandieren commented 7 years ago

Released 0.11.2 which has this fixed.

balepc commented 6 years ago

I still had this issue with 0.11.2 - https://pastebin.com/PkvvMHAA

keesvandieren commented 6 years ago

Based on this stack-trace, it is impossible to decide whether it is caused by gdx-pay or not.

Why do you think its gdx-pay? Any more concrete pointers?

Our apps no longer do have this problem after 0.11.2

balepc commented 6 years ago

If I remove gdx-pay it doesn't crash any more. What kind of logs I could provide?

keesvandieren commented 6 years ago

Can you reproduce the crash? If that is true, can you submit a minimal app that produces the issue?