fix issue introduced with 85df1e7f98: (process:24445): librsvg-CRITICAL **: 16:03:34.427: rsvg_handle_read_stream_sync: assertion 'is_input_stream(stream)' failed

This commit is contained in:
Peter Bieringer 2021-03-20 16:37:56 +01:00
parent dc617b52fa
commit fda2a4ec74

View File

@ -178,14 +178,22 @@ cImageImporterSVG::cImageImporterSVG() {
cImageImporterSVG::~cImageImporterSVG() {
if (handle) {
rsvg_handle_read_stream_sync(handle, NULL, NULL, NULL);
#if LIBRSVG_CHECK_VERSION (2, 46, 0)
// rsvg_handle_close is deprecated since version 2.46 and looks like even not required if used with rsvg_handle_new_from_file
#else
rsvg_handle_close(handle, NULL);
#endif
g_object_unref(handle);
}
}
bool cImageImporterSVG::LoadImage(const char *path) {
if (handle) {
rsvg_handle_read_stream_sync(handle, NULL, NULL, NULL);
#if LIBRSVG_CHECK_VERSION (2, 46, 0)
// rsvg_handle_close is deprecated since version 2.46 and looks like even not required if used with rsvg_handle_new_from_file
#else
rsvg_handle_close(handle, NULL);
#endif
g_object_unref(handle);
}
@ -521,3 +529,5 @@ void cSVGTemplate::ReplaceTokens(string &line, size_t tokenStart, size_t tokenEn
std::replace( svgAlpha.begin(), svgAlpha.end(), ',', '.');
line.replace(hitAlpha, hitAlphaEnd - hitAlpha + 2, svgAlpha);
}
// vim: ts=4 sw=4 et