mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-03 17:22:54 +01:00
fix(YouTube - Litho Filter): Don't remove the buffer until the thread stops (#461)
This commit is contained in:
parent
efa60dc64a
commit
2188607340
@ -425,6 +425,10 @@ public final class LithoFilterPatch {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static void setProtoBuffer(@NonNull ByteBuffer protobufBuffer) {
|
public static void setProtoBuffer(@NonNull ByteBuffer protobufBuffer) {
|
||||||
|
// Set the buffer to a thread local. The buffer will remain in memory, even after the call to #filter completes.
|
||||||
|
// This is intentional, as it appears the buffer can be set once and then filtered multiple times.
|
||||||
|
// The buffer will be cleared from memory after a new buffer is set by the same thread,
|
||||||
|
// or when the calling thread eventually dies.
|
||||||
bufferThreadLocal.set(protobufBuffer);
|
bufferThreadLocal.set(protobufBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,8 +456,6 @@ public final class LithoFilterPatch {
|
|||||||
if (pathSearchTree.matches(parameter.path, parameter)) return true;
|
if (pathSearchTree.matches(parameter.path, parameter)) return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogHelper.printException(() -> "Litho filter failure", ex);
|
LogHelper.printException(() -> "Litho filter failure", ex);
|
||||||
} finally {
|
|
||||||
bufferThreadLocal.remove(); // Cleanup and remove the buffer.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user