mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19: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 { historyState } from "$lib/state/history.svelte";
|
||||||
import { getAdapter } from "$lib/request-manager";
|
import { getAdapter } from "$lib/request-manager";
|
||||||
import { setReading, clearReading } from "$lib/core/discord";
|
import { setReading, clearReading } from "$lib/core/discord";
|
||||||
|
import { revokeBlobUrl } from "$lib/core/cache/imageCache";
|
||||||
import type { ReaderSettings } from "$lib/state/reader.svelte";
|
import type { ReaderSettings } from "$lib/state/reader.svelte";
|
||||||
import ReaderControls from "$lib/components/reader/ReaderControls.svelte";
|
import ReaderControls from "$lib/components/reader/ReaderControls.svelte";
|
||||||
import PageView from "$lib/components/reader/PageView.svelte";
|
import PageView from "$lib/components/reader/PageView.svelte";
|
||||||
@@ -216,9 +217,13 @@
|
|||||||
? () => goForward(style, adjacent, lastPage, maybeMarkCurrentRead, startAtLast)
|
? () => goForward(style, adjacent, lastPage, maybeMarkCurrentRead, startAtLast)
|
||||||
: () => goBack(style, adjacent, startAtLast));
|
: () => goBack(style, adjacent, startAtLast));
|
||||||
|
|
||||||
// clear Discord presence before closing
|
// clear Discord presence and free page blob textures before closing
|
||||||
function handleCloseReader() {
|
function handleCloseReader() {
|
||||||
clearReading().catch(() => {});
|
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();
|
readerState.closeReader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { readerState } from "$lib/state/reader.svelte";
|
import { readerState } from "$lib/state/reader.svelte";
|
||||||
import { fetchPages } from "./pageLoader";
|
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";
|
import { clearResolvedUrlCache } from "$lib/core/cache/pageCache";
|
||||||
|
|
||||||
export function scheduleResumeDismiss() {
|
export function scheduleResumeDismiss() {
|
||||||
@@ -21,7 +21,14 @@ export async function loadChapter(
|
|||||||
abortCtrl.current = ctrl;
|
abortCtrl.current = ctrl;
|
||||||
|
|
||||||
cancelQueuedFetches();
|
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;
|
startAtLastPage.current = false;
|
||||||
markedRead.clear();
|
markedRead.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user