SourceForge has been redesigned. Learn more.
Close

#93 cairo drivers crash

closed-fixed
nobody
None
5
2011-09-07
2010-05-29
No

The cairo drivers will crash on some systems when dynamically loaded and the user does the following: plinit() .. code .. plend() .. code .. plinit() .. code .. This bug is discussed in some detail in this thread: http://www.mail-archive.com/plplot-devel@lists.sourceforge.net/msg02032.html. The suggested work around is to call plend1() instead of plend(). It is thought to be due to an issue with dynamically loading and unloading the cairo libraries multiple times, as this is what calling plend() does in comparison to plend1().

Discussion

  • Jari Häkkinen

    Jari Häkkinen - 2010-08-17

    After extensive debugging I think the problem is related to GObjects in pango. The problem seems to be that the pango_cairo font map object "constructor" is not run the second time the pango_cairo fontmap is loaded/needed. As a conseuence a null pointer is used since the error is not catched in plplot. Is this a plplot, glib or pango problem?

     
  • Jari Häkkinen

    Jari Häkkinen - 2010-08-17

    It turns out that 'pango_cairo_fc_font_map_get_type' (source found in pango/pangocairo-fcfontmap.c) is run again after reloading pangocairo dynamic library. However the 'pango_cairo_fc_font_map' type and interface is registered as static and this probably causes the runtime problems. glib supports dynamic registering so I'll try to change the code to dynamic registering of type and interface.

     
  • Jari Häkkinen

    Jari Häkkinen - 2010-08-20

    I could not get my mac to load the cairo module after changing pango_cairo_fc_font_map to use dynamic type loading. There is a note in the libtool libltdl docs saying that Mac OS X differentiate between loading of different types of runtime libraries. Maybe this is my problem. Anyhow, I won't waste more time on this but the solution is to not unload the modules or persuade the pango team to change their implementation of pango_cairo_fc_font_map. There is a simple work around for plplot.

    In C++, simply create a plstream object that is not destroyed until plotting is finished. This will ensure that cairo is never unloaded.

     
  • Andrew Ross

    Andrew Ross - 2011-09-07

    The recent change to mark all dynamic drivers as resident, which was implemented to fix a crash with the qt driver, has the side effect of also fixing this longstanding issue with the cairo driver. As the library is never unloaded we never run into the issue with it being reinitialised.

     
  • Andrew Ross

    Andrew Ross - 2011-09-07
    • status: open --> closed-fixed
     

Log in to post a comment.