From 6dbd9bfb129a94c2da9a96ceea2708f1cf18cb5c Mon Sep 17 00:00:00 2001 From: Shaka Huang Date: Sun, 28 Jun 2020 21:30:38 +0800 Subject: [PATCH] Place pthread_mutex_init() before init_list() Fix crash in #2900 Signed-off-by: Shaka Huang --- native/jni/magiskhide/hide_utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/jni/magiskhide/hide_utils.cpp b/native/jni/magiskhide/hide_utils.cpp index a56219db7..76f88c62c 100644 --- a/native/jni/magiskhide/hide_utils.cpp +++ b/native/jni/magiskhide/hide_utils.cpp @@ -239,6 +239,9 @@ int launch_magiskhide() { LOGI("* Starting MagiskHide\n"); + // Initialize the mutex lock + pthread_mutex_init(&monitor_lock, nullptr); + // Initialize the hide list if (!init_list()) return DAEMON_ERROR; @@ -247,9 +250,6 @@ int launch_magiskhide() { if (DAEMON_STATE >= STATE_BOOT_COMPLETE) hide_late_sensitive_props(); - // Initialize the mutex lock - pthread_mutex_init(&monitor_lock, nullptr); - // Start monitoring void *(*start)(void*) = [](void*) -> void* { proc_monitor(); return nullptr; }; if (xpthread_create(&proc_monitor_thread, nullptr, start, nullptr))