New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_mxml_init / _mxml_destructor causes SEGV in main app. #103
Comments
"mxml-private.c.diff":
|
Original reporter: I have attached a proposed patch to fix this bug. |
Original reporter: The patch is gnu (glibc) specific. |
"mxml-private.c.diff":
|
Original reporter: I have revised the patch to ensure that it will at least compile on non-gnu compilers that have pthread support. It does not fix the bug on these platforms; I only have access to gcc and msvc so I must leave that to others to implement - use of _fini should work on some, but not necessarily all. |
Original reporter: Michael Sweet OK, so for starters it is basically never safe to call dlclose except for simple plugins with known dependencies. You always run the risk of leaving inconsistent state because of initializations that are done at load time. This isn't a problem specific to Mini-XML, and there is no portable way of dealing with it. The GCC destructor attribute hack is very platform-specific. I will do some research to see if I can come up with an acceptable solution, but in the meantime I would file a bug with the program that is unloading plugins - that just isn't safe to do in the general case on pretty much any platform. |
"str103.patch":
|
Original reporter: Michael Sweet Fixed in Subversion repository. |
Version: 2.6
Original reporter:
We are developing an application plugin (a .so) on Linux that uses mxml. Unfortunately mxml causes the main application to SEGV. Having inspected the code thoroughly I have deduced why:
Main application (Rosegarden DAW) starts thread to scan for plugins
Rosegarden loads our plugin and invokes function to fetch descriptor plugin's descriptor.
libmxml.so is loaded automatically with plugin.so.
plugin.so loads some xml
_mxml_init is invoked. Thread specific key is created with _mxml_destructor attached.
plugin.so returns descriptor.
RG unloads plugin.so and libxml.so
RG thread ends. Thread cleanup calls _xml_destructor, which is no longer there - SEGV.
FIX - a fini routine is needed to call pthread_key_delete to remove the thread specific key.
The text was updated successfully, but these errors were encountered: