LoginHomeBugs & FeaturesDocumentationDownloadForums
ID:103
Status:5 - New
Priority:5 - Critical, e.g. nothing working at all
Scope:2 - Specific to an operating system
Subsystem:Unassigned
Summary:_mxml_init / _mxml_destructor causes SEGV in main app.
Version:2.6
Created By:sgparry
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File

Name/Time/DateFilename
sgparry
12:56 Feb 21, 2010
mxml-private.c.diff
sgparry
13:33 May 24, 2010
mxml-private.c
sgparry
13:33 May 24, 2010
mxml-private.c.diff

Trouble Report Dialog:

Name/Time/DateText
sgparry
17:42 Feb 20, 2010
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.
sgparry
12:57 Feb 21, 2010
I have attached a proposed patch to fix this bug.
alonbl
12:28 May 14, 2010
The patch is gnu (glibc) specific.
sgparry
13:57 May 24, 2010
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.
If anyone has Solaris C I believe that the use of:
#pragma fini (_mxml_fini)
and #ifdef-ing out the attribute(destructor) may do the trick, but I have no way of checking.
alonbl - what compiler / platform are you targetting?