The `rsvg_term` function has been a no-op for some time:¹
rsvg_term has been deprecated since version 2.36 and should not be used in
newly-written code.
There is no need to de-initialize librsvg.
This function does nothing.
Graphviz was calling it when linked against librsvg 2.36 (2.36.0 was released
2012-03-26). I do not know why this code was conditional as `rsvg_term` has been
a no-op since 2.35.0.² Moreover, calling it prior to it becoming a no-op was
wrong too. The commit that removed its functionality notes:
rsvg_term() was dangerous to call
The problem is that it previously called libxml2’s `xmlCleanupParser` whose
documentation states:³
This function name is somewhat misleading. It does not clean up parser state,
it cleans up memory allocated by the library itself. It is a cleanup function
for the XML library. It tries to reclaim all related global memory allocated
for the library processing. It doesn't deallocate any document related memory.
One should call xmlCleanupParser() only when the process has finished using
the library and all XML/HTML documents built with it. See also xmlInitParser()
which has the opposite function of preparing the library for operations.
WARNING: if your application is multithreaded or has plugin support calling
this may crash the application if another thread or a plugin is still using
libxml2. It's sometimes very hard to guess if libxml2 is in use in the
application, some libraries or plugins may use it without notice. In case of
doubt abstain from calling this function or do it just before calling exit()
to avoid leak reports from valgrind !
This seems to have come to light ~2010.⁴ But presumably there is still a long
tail of software in the wild still, like Graphviz, erroneously calling
`rsvg_term`.
¹ https://www.manpagez.com/html/rsvg-2.0/rsvg-2.0-2.52.1/RsvgHandle.php#rsvg-term
² Commit
7f27418cfcdea9cdd6b2bf81ea0b0f6cc5a18b30 of librsvg.
³ https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlCleanupParser
⁴ https://lists.fedoraproject.org/pipermail/devel/2010-January/129117.html
https://bugzilla.redhat.com/show_bug.cgi?id=542277
https://bugzilla.gnome.org/show_bug.cgi?id=592100