mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 01:09:56 -05:00
fix: revoke page blob URLs on chapter change and reader close
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import { historyState } from "$lib/state/history.svelte";
|
||||
import { getAdapter } from "$lib/request-manager";
|
||||
import { setReading, clearReading } from "$lib/core/discord";
|
||||
import { revokeBlobUrl } from "$lib/core/cache/imageCache";
|
||||
import type { ReaderSettings } from "$lib/state/reader.svelte";
|
||||
import ReaderControls from "$lib/components/reader/ReaderControls.svelte";
|
||||
import PageView from "$lib/components/reader/PageView.svelte";
|
||||
@@ -216,9 +217,13 @@
|
||||
? () => goForward(style, adjacent, lastPage, maybeMarkCurrentRead, startAtLast)
|
||||
: () => goBack(style, adjacent, startAtLast));
|
||||
|
||||
// clear Discord presence before closing
|
||||
// clear Discord presence and free page blob textures before closing
|
||||
function handleCloseReader() {
|
||||
clearReading().catch(() => {});
|
||||
for (const url of readerState.pageUrls) revokeBlobUrl(url);
|
||||
for (const strip of readerState.stripChapters) {
|
||||
for (const url of strip.urls) revokeBlobUrl(url);
|
||||
}
|
||||
readerState.closeReader();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { readerState } from "$lib/state/reader.svelte";
|
||||
import { fetchPages } from "./pageLoader";
|
||||
import { cancelQueuedFetches } from "$lib/core/cache/imageCache";
|
||||
import { cancelQueuedFetches, revokeBlobUrl } from "$lib/core/cache/imageCache";
|
||||
import { clearResolvedUrlCache } from "$lib/core/cache/pageCache";
|
||||
|
||||
export function scheduleResumeDismiss() {
|
||||
@@ -21,7 +21,14 @@ export async function loadChapter(
|
||||
abortCtrl.current = ctrl;
|
||||
|
||||
cancelQueuedFetches();
|
||||
if (useBlob) clearResolvedUrlCache();
|
||||
if (useBlob) {
|
||||
clearResolvedUrlCache();
|
||||
// revoke blob URLs for all loaded pages so the GPU can release their textures
|
||||
for (const url of readerState.pageUrls) revokeBlobUrl(url);
|
||||
for (const strip of readerState.stripChapters) {
|
||||
for (const url of strip.urls) revokeBlobUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
startAtLastPage.current = false;
|
||||
markedRead.clear();
|
||||
|
||||
Reference in New Issue
Block a user