Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:Alexander_Naumov:SLE-12:Update
rrdtool
rrdtool-1.4.7-pango-fontmap-threading-issue.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rrdtool-1.4.7-pango-fontmap-threading-issue.patch of Package rrdtool
@@ -, +, @@ --- src/Makefile.am | 1 + src/mutex.h | 23 +++++++++++++++++++++++ src/rrd_graph.c | 12 ++++++++++-- src/rrd_graph.h | 2 ++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/mutex.h --- a/src/Makefile.am +++ a/src/Makefile.am @@ -56,6 +56,7 @@ endif noinst_HEADERS = \ unused.h \ gettext.h \ + mutex.h \ rrd_getopt.h rrd_parsetime.h \ rrd_config_bottom.h rrd_i18n.h \ rrd_format.h rrd_tool.h rrd_xport.h rrd.h rrd_rpncalc.h \ --- a/src/mutex.h +++ a/src/mutex.h @@ -0,0 +1,23 @@ +/* + * mutex.h - Cross platform mutex + */ + +#ifndef MUTEX_H_B13C67AB432C4C39AF823A339537CA40 +#define MUTEX_H_B13C67AB432C4C39AF823A339537CA40 + +#include <pthread.h> + +#define mutex_t pthread_mutex_t +#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +#define mutex_init(mutex) pthread_mutex_init((mutex), NULL) +#define mutex_lock(mutex) pthread_mutex_lock((mutex)) +#define mutex_unlock(mutex) pthread_mutex_unlock((mutex)) +#define mutex_cleanup(mutex) pthread_mutex_destroy((mutex)) + +#endif /* MUTEX__H */ + +/* + * vim: set sw=2 sts=2 ts=8 et fdm=marker : + */ + --- a/src/rrd_graph.c +++ a/src/rrd_graph.c @@ -354,9 +354,11 @@ int im_free( free(im->rendered_image); } + mutex_lock(im->fontmap_mutex); if (im->layout) { g_object_unref (im->layout); } + mutex_unlock(im->fontmap_mutex); if (im->surface) cairo_surface_destroy(im->surface); @@ -4064,6 +4066,7 @@ void rrd_graph_init( unsigned int i; char *deffont = getenv("RRD_DEFAULT_FONT"); static PangoFontMap *fontmap = NULL; + static mutex_t fontmap_mutex = MUTEX_INITIALIZER; PangoContext *context; #ifdef HAVE_TZSET @@ -4138,6 +4141,7 @@ void rrd_graph_init( im->surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 10, 10); im->cr = cairo_create(im->surface); + im->fontmap_mutex = &fontmap_mutex; for (i = 0; i < DIM(text_prop); i++) { im->text_prop[i].size = -1; @@ -4145,8 +4149,10 @@ void rrd_graph_init( rrd_set_font_desc(im,i, deffont ? deffont : text_prop[i].font,text_prop[i].size); } + mutex_lock(im->fontmap_mutex); + if (fontmap == NULL){ - fontmap = pango_cairo_font_map_get_default(); + fontmap = pango_cairo_font_map_new(); } context = pango_cairo_font_map_create_context((PangoCairoFontMap*)fontmap); @@ -4167,7 +4173,7 @@ void rrd_graph_init( (im->font_options, CAIRO_HINT_METRICS_ON); cairo_font_options_set_antialias(im->font_options, CAIRO_ANTIALIAS_GRAY); - + mutex_unlock(im->fontmap_mutex); for (i = 0; i < DIM(graph_col); i++) im->graph_col[i] = graph_col[i]; @@ -4688,8 +4694,10 @@ void rrd_graph_options( if (status != 0) return; } + mutex_lock(im->fontmap_mutex); pango_cairo_context_set_font_options(pango_layout_get_context(im->layout), im->font_options); pango_layout_context_changed(im->layout); + mutex_unlock(im->fontmap_mutex); --- a/src/rrd_graph.h +++ a/src/rrd_graph.h @@ -25,6 +25,7 @@ #include "rrd_tool.h" #include "rrd_rpncalc.h" +#include "mutex.h" #ifdef WIN32 # include <windows.h> @@ -283,6 +284,7 @@ typedef struct image_desc_t { PangoLayout *layout; /* the pango layout we use for writing fonts */ rrd_info_t *grinfo; /* root pointer to extra graph info */ rrd_info_t *grinfo_current; /* pointing to current entry */ + mutex_t *fontmap_mutex; /* Mutex for locking the global fontmap */ } image_desc_t; /* Prototypes */ --
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor