summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2022-01-08 08:06:38 +0100
committerKim Woelders <kim@woelders.dk>2022-01-08 16:08:38 +0100
commitffbd8bbca06f5ea608b8f78e73148515adfa8ecd (patch)
treebb7e4465f451c6db4886a2886ebca0c7a8075579
parenta542fb672406be26599c089eee2c6e350bace9dd (diff)
downloadimlib2-ffbd8bbca06f5ea608b8f78e73148515adfa8ecd.tar.gz
SVG loader: Avoid problems when loading the module more than once
It appears that the svg loader fails when dlopen'ed a second time, presumably due to some issue in librsvg2: thread '<unnamed>' panicked at 'Type RsvgHandle has already been registered', /builddir/build/BUILD/librsvg-2.52.4/vendor/glib/src/subclass/types.rs:751:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5 A second load of a loader will only happen if an application calls imlib_flush_loaders(), which I don't see why regular applications would need to do. However, calling imlib_flush_loaders() shouldn't cause applications to potentially fail (abort) anyway. The failure can be avoided by dlopen'ing with RTLD_NODELETE, but that would apply to all loaders, which doesn't seem right. With the solution here the svg.so module is marked to be un-unloadable which seems to solve the problem and doesn't affect other modules.
-rw-r--r--src/modules/loaders/Makefile.am2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/loaders/Makefile.am b/src/modules/loaders/Makefile.am
index d7fea3a..04a388b 100644
--- a/src/modules/loaders/Makefile.am
+++ b/src/modules/loaders/Makefile.am
@@ -98,7 +98,7 @@ pnm_la_LIBTOOLFLAGS = --tag=disable-static
svg_la_SOURCES = loader_svg.c
svg_la_CPPFLAGS = $(SVG_CFLAGS) $(AM_CPPFLAGS)
-svg_la_LDFLAGS = -module -avoid-version
+svg_la_LDFLAGS = -module -avoid-version -Wl,-z,nodelete
svg_la_LIBADD = $(SVG_LIBS) $(top_builddir)/src/lib/libImlib2.la
svg_la_LIBTOOLFLAGS = --tag=disable-static