From 344f64eab7a5606d345b2277cd51fd8fa1099ad2 Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Thu, 3 Nov 2022 12:43:06 +0100 Subject: [PATCH] Fixes issue loading image cache data With some versions of Glib/Glibmm library on MacOS, Glib::KeyFile "load_from_file" function does not raise a Glib::Error but another exception. This causes cached data not saved on disk (and thumbnails not displayed in explorer). Adds robustness testing if file is present first before calling the function --- rtgui/cacheimagedata.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index d44ca28ec..8e20df2e3 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "version.h" #include @@ -250,7 +251,9 @@ int CacheImageData::save (const Glib::ustring& fname) Glib::KeyFile keyFile; try { - keyFile.load_from_file (fname); + if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) { + keyFile.load_from_file (fname); + } } catch (Glib::Error&) {} keyFile.set_string ("General", "MD5", md5);