mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated (#577)
* Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated * Allocate static mutexes on the heap memory to avoid destruction at app exit * ASThread to use ASDisplayNodeCAssert() instead of assert()
This commit is contained in:
@@ -40,8 +40,9 @@
|
||||
{
|
||||
if (self = [super init]) {
|
||||
// Concurrently initialising TextKit components crashes (rdar://18448377) so we use a global lock.
|
||||
static ASDN::Mutex __staticMutex;
|
||||
ASDN::MutexLocker l(__staticMutex);
|
||||
// Allocate __staticMutex on the heap to prevent destruction at app exit (https://github.com/TextureGroup/Texture/issues/136)
|
||||
static ASDN::StaticMutex& __staticMutex = *new ASDN::StaticMutex;
|
||||
ASDN::StaticMutexLocker l(__staticMutex);
|
||||
|
||||
__instanceLock__ = std::make_shared<ASDN::Mutex>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user