kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=c85d63d710633cd9dd3b120007b876bfcd38aa04
commit c85d63d710633cd9dd3b120007b876bfcd38aa04 Author: Kim Woelders <[email protected]> Date: Thu Apr 7 10:50:30 2022 +0200 image: Fix undesired change of format In a previous commit im->format was always set before calling a loader in order to make it available e.g. from loader progress callbacks via imlib_image_format(). However, setting the format with imlib_image_set_format() on a non-immediately loaded image would be overridden when the image data was subsequently loaded. Also move the initial setting of im->format up front so it's also set for legacy load()s. --- src/lib/image.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/image.c b/src/lib/image.c index d4f5f14..cc3acec 100644 --- a/src/lib/image.c +++ b/src/lib/image.c @@ -284,6 +284,9 @@ __imlib_LoadImageWrapper(const ImlibLoader * l, ImlibImage * im, int load_data) unsigned int t0 = __imlib_time_us(); #endif + if (!im->format) + im->format = strdup(l->formats[0]); + if (l->load2) { FILE *fp = NULL; @@ -294,8 +297,6 @@ __imlib_LoadImageWrapper(const ImlibLoader * l, ImlibImage * im, int load_data) if (!im->fp) return 0; } - free(im->format); - im->format = strdup(l->formats[0]); rc = l->load2(im, load_data); if (fp) --
