diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-23 13:59:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-23 14:01:37 +0100 |
commit | 682cb83ed59233decbeeaff68c4d871442b58bb1 (patch) | |
tree | c61654dbabdb54007c2a96b90f72ab4b3ca3c955 /vcl | |
parent | 4ad9e3f5be10bde030338f744d56ffa6c7736bd0 (diff) |
Resolves: fdo#50975 rsvg_handle_new_from_data calls rsvg_handle_close
rsvg_handle_new_from_data calls rsvg_handle_fill_with_data which itself calls
rsvg_handle_close on success, so we don't have to.
And older versions of librsvg (e.g. 2.16.1) don't protect against
rsvg_handle_close getting called twice, although new versions do,
so we crash on e.g. RHEL-5
Change-Id: I451075e50c9c2c7b07289356d7a92eb55db82f9f
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/components/rasterizer_rsvg.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/vcl/source/components/rasterizer_rsvg.cxx b/vcl/source/components/rasterizer_rsvg.cxx index 00940c264158..f5a7f57d6adc 100644 --- a/vcl/source/components/rasterizer_rsvg.cxx +++ b/vcl/source/components/rasterizer_rsvg.cxx @@ -117,7 +117,6 @@ public: // LibRSVG void rsvg_init() { (*mp_rsvg_init)(); } RsvgHandle* rsvg_handle_new_from_data( const guint8* data, gsize size, GError** error) { return( (*mp_rsvg_handle_new_from_data)( data, size, error ) ); } - gboolean rsvg_handle_close( RsvgHandle* handle, GError** error ) { return( (*mp_rsvg_handle_close)( handle, error ) ); } void rsvg_handle_set_dpi_x_y( RsvgHandle* handle, double dpix, double dpiy ) { (*mp_rsvg_handle_set_dpi_x_y)( handle, dpix, dpiy ); } void rsvg_handle_get_dimensions( RsvgHandle* handle, RsvgDimensionData* dimensions ) { (*mp_rsvg_handle_get_dimensions)( handle, dimensions ); } gboolean rsvg_handle_render_cairo( RsvgHandle* handle, cairo_t* cairo ) { return( (*mp_rsvg_handle_render_cairo)( handle, cairo ) ); } @@ -137,7 +136,6 @@ private: // LibRSVG void (*mp_rsvg_init)( void ); RsvgHandle* (*mp_rsvg_handle_new_from_data)( const guint8*, gsize, GError** ); - gboolean (*mp_rsvg_handle_close)( RsvgHandle*, GError** ); void (*mp_rsvg_handle_set_dpi_x_y)( RsvgHandle*, double, double ); void (*mp_rsvg_handle_get_dimensions)( RsvgHandle*, RsvgDimensionData* ); gboolean (*mp_rsvg_handle_render_cairo)( RsvgHandle*, cairo_t* ); @@ -189,14 +187,12 @@ LibraryWrapper::LibraryWrapper() : { mp_rsvg_init = ( void (*)( void ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_init" ); mp_rsvg_handle_new_from_data = ( RsvgHandle* (*)( const guint8*, gsize, GError** ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_handle_new_from_data" ); - mp_rsvg_handle_close = ( gboolean (*)( RsvgHandle*, GError** ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_handle_close" ); mp_rsvg_handle_set_dpi_x_y = ( void (*)( RsvgHandle*, double, double ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_handle_set_dpi_x_y" ); mp_rsvg_handle_get_dimensions = ( void (*)( RsvgHandle*, RsvgDimensionData* ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_handle_get_dimensions" ); mp_rsvg_handle_render_cairo = ( gboolean (*)( RsvgHandle*, cairo_t* ) ) osl_getAsciiFunctionSymbol( mpRSVGLib, "rsvg_handle_render_cairo" ); if( !( mp_rsvg_init && mp_rsvg_handle_new_from_data && - mp_rsvg_handle_close && mp_rsvg_handle_set_dpi_x_y && mp_rsvg_handle_get_dimensions && mp_rsvg_handle_render_cairo ) ) @@ -415,12 +411,15 @@ uno::Reference< graphic::XGraphic > Rasterizer::implGetXGraphicFromSurface( cair } while( nReadSize == nBlockSize ); - if( aDataBuffer.size() && - ( NULL != ( mpRsvgHandle = rLib.rsvg_handle_new_from_data( reinterpret_cast< sal_uInt8* >( &aDataBuffer[ 0 ] ), - aDataBuffer.size(), NULL ) ) ) && - !rLib.rsvg_handle_close( mpRsvgHandle, NULL ) ) + if (aDataBuffer.size()) { - implFreeRsvgHandle(); + //See: fdo#50975 rsvg_handle_new_from_data calls + //rsvg_handle_fill_with_data which itself calls rsvg_handle_close + //on success. Older versions of librsvg (e.g. 2.16.1) don't + //protect against rsvg_handle_close getting called twice, so we + //shouldn't additionally call svg_handle_close here. + mpRsvgHandle = rLib.rsvg_handle_new_from_data( reinterpret_cast< sal_uInt8* >( &aDataBuffer[ 0 ] ), + aDataBuffer.size(), NULL ); } } |