-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suspend all threads when doing hook stuffs to prevent crashes caused …
…by GC
- Loading branch information
Showing
5 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package com.elderdrivers.riru.xposed.core; | ||
|
||
import com.elderdrivers.riru.xposed.Main; | ||
import com.elderdrivers.riru.xposed.entry.hooker.OnePlusWorkAroundHooker; | ||
import com.elderdrivers.riru.xposed.util.Utils; | ||
|
||
|
@@ -111,8 +112,13 @@ public static void backupAndHook(Object target, Method hook, Method backup) { | |
if (backup != null) { | ||
HookMethodResolver.resolveMethod(hook, backup); | ||
} | ||
if (!backupAndHookNative(target, hook, backup)) { | ||
throw new RuntimeException("Failed to hook " + target + " with " + hook); | ||
long obj = Main.suspendAllThreads(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
solohsu
Author
Member
|
||
try { | ||
if (!backupAndHookNative(target, hook, backup)) { | ||
throw new RuntimeException("Failed to hook " + target + " with " + hook); | ||
} | ||
} finally { | ||
Main.resumeAllThreads(obj); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This seems to have made situation worse. See #127
I am getting far less GC related crashes without it.