summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/lcms.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-07-05 15:11:40 -0500
committerDudemanguy <random342@airmail.cc>2023-07-06 13:08:23 +0000
commitee69d99bd409d31ec35ee6f6be53db4ff29a55c9 (patch)
tree74d33ae41d88d1467b82fed966e803a3300607cd /video/out/gpu/lcms.c
parent48e0ee9979c2928edef813e64592217420dbd4a0 (diff)
downloadmpv-ee69d99bd409d31ec35ee6f6be53db4ff29a55c9.tar.bz2
mpv-ee69d99bd409d31ec35ee6f6be53db4ff29a55c9.tar.xz
various: correctly ignore cache files with --no-config
--no-config should prevent loading user files of any type: configs, cache, etc. For cache files, this case wasn't properly handled and it was assumed they would always get something. vo_gpu's shader cache actually already handles this, so it was left untouched. In theory, demuxer cache should never have this issue because saving it to disk is disabled by default (and likely that will never change), but go ahead and change it for consistency's sake. Fixes some segfaults with --no-config and various combinations of settings (particularly --vo=gpu-next).
Diffstat (limited to 'video/out/gpu/lcms.c')
-rw-r--r--video/out/gpu/lcms.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c
index 7880f279e6..47ea160d8c 100644
--- a/video/out/gpu/lcms.c
+++ b/video/out/gpu/lcms.c
@@ -359,12 +359,13 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
cache_dir = mp_find_user_file(tmp, p->global, "cache", "");
}
- cache_file = talloc_strdup(tmp, "");
- for (int i = 0; i < sizeof(hash); i++)
- cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]);
- cache_file = mp_path_join(tmp, cache_dir, cache_file);
-
- mp_mkdirp(cache_dir);
+ if (cache_dir && cache_dir[0]) {
+ cache_file = talloc_strdup(tmp, "");
+ for (int i = 0; i < sizeof(hash); i++)
+ cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]);
+ cache_file = mp_path_join(tmp, cache_dir, cache_file);
+ mp_mkdirp(cache_dir);
+ }
}
// check cache