eliminate a possibility for the loader to lock up
All checks were successful
/ Build BaseBand Loader (push) Successful in 1m17s

This commit is contained in:
Daniella / Tove 2024-06-18 17:31:21 +02:00
parent 3f18de7575
commit d7422420e0
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -119,10 +119,11 @@ public class CustomClassLoader extends ClassLoader implements Util {
} }
@Override @Override
protected Class<?> findClass(String name) throws ClassNotFoundException { protected synchronized Class<?> findClass(String name) throws ClassNotFoundException {
synchronized (Launch.classLoader) {
if (names.contains(name.replace('.', '/') + ".class")) { if (names.contains(name.replace('.', '/') + ".class")) {
Class<?> clazz = loadBBClass(name); Class<?> clazz = loadBBClass(name);
if(clazz != null) if (clazz != null)
return clazz; return clazz;
} }
try { try {
@ -131,6 +132,7 @@ public class CustomClassLoader extends ClassLoader implements Util {
return super.findClass(name); return super.findClass(name);
} }
} }
}
private Class<?> loadBBClass(String name) { private Class<?> loadBBClass(String name) {
/*Set<ClassLoader> uniqueClassLoaders = Thread.getAllStackTraces().keySet().stream() /*Set<ClassLoader> uniqueClassLoaders = Thread.getAllStackTraces().keySet().stream()