Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash due to the use of method swizzling #586

Open
nalexn opened this issue Apr 11, 2023 · 7 comments
Open

Crash due to the use of method swizzling #586

nalexn opened this issue Apr 11, 2023 · 7 comments

Comments

@nalexn
Copy link

nalexn commented Apr 11, 2023

Description

We've recently started getting random crashes with the following stack:

Crashed: com.apple.main-thread
0   libobjc.A.dylib                0x2224 cache_getImp + 132
1   libobjc.A.dylib                0x1057c cache_t::shouldFlush(objc_selector*, void (*)()) const + 64
2   libobjc.A.dylib                0xc668 invocation function for block in flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 32
3   libobjc.A.dylib                0xd534 flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 296
4   libobjc.A.dylib                0x1c6b8 _method_setImplementation(objc_class*, method_t*, void (*)()) + 224
5   libobjc.A.dylib                0x19da4 method_setImplementation + 96
6   myapp                          0x5b97ec one-time initialization function for dismissSwizzling + 647 (FloatingPanelController.swift:647)
7   libdispatch.dylib              0x64094 _dispatch_client_callout + 16
8   libdispatch.dylib              0x34bf8 _dispatch_once_callout + 28
9   myapp                          0x5b6c98 FloatingPanelController.setUp() + 641 (FloatingPanelController.swift:641)
10  myapp                          0x5b9fa0 specialized FloatingPanelController.init(delegate:) + 4317159328 (<compiler-generated>:4317159328)
11  myapp                          0x5b6a68 FloatingPanelController.init(delegate:) + 4317145704 (<compiler-generated>:4317145704)

Expected behavior

No crash

Actual behavior

A random crash

Steps to reproduce

I believe we've started seeing this crash after adding other libraries that also do swizzling. While this is understandable for SDKs like analytics to do the swizzling, I believe the libraries like this should refrain from using it. Please explore less hacky alternatives.

How do you display panel(s)?

  • Add as child view controllers

How many panels do you displays?

  • 1

Environment

Library version

1.7.6

Installation method

SPM

iOS version(s)

iOS 16.4

Xcode version

14.3

@scenee
Copy link
Owner

scenee commented Jul 1, 2023

In v2.6.3, the swizzling implementation has been updated for cases where it is used with the analysis library. I would like you to try the version and please give me a feedback.

@nihedr9
Copy link

nihedr9 commented Nov 23, 2023

any update on this ?
still having the problem in v2.8.0

Capture d’écran 2023-11-23 à 15 15 54

@scenee
Copy link
Owner

scenee commented Dec 1, 2023

@nihedr9

Is it possible to let me know which libraries the above crashes occur when used with?

scenee added a commit that referenced this issue Dec 2, 2023
@nihedr9
Copy link

nihedr9 commented Dec 4, 2023

@scenee not using any special third party librairies with it

Do you want me to create a PR with your commit bea2980

@scenee
Copy link
Owner

scenee commented Feb 3, 2024

I'm sorry for the late reply. I've added the commit into the master as 0e0f773. It would be helpful to know if this resolved the crash issue.

scenee added a commit that referenced this issue Feb 3, 2024
@scenee
Copy link
Owner

scenee commented Feb 23, 2024

@nalexn, @nihedr9

I've released a possible fix at 0e0f773 in v2.8.2. If you still encounter this issue, I'm glad for you to report it in this issue. I would continue to investigate it.

@nihedr9
Copy link

nihedr9 commented Feb 28, 2024

hey @scenee
We don't have the crash anymore. Thank you for your assistance 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants