Author: Carlos Lopez <genet...@gmail.com> Date: Thu Nov 29 19:14:48 2012 +0100
CairoSurface: when the CairoSurface receives a pointer to a cairo_surface_t and it is null then don't throw a message error. Instead set it to the current cairo_surface_t. In any case when the new cairo_surface_t pointer is received the previous one is unmapped if already is. --- synfig-core/src/synfig/surface.cpp | 10 +++++++--- synfig-core/src/synfig/surface.h | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/synfig-core/src/synfig/surface.cpp b/synfig-core/src/synfig/surface.cpp index 722dfa4..b24fc96 100644 --- a/synfig-core/src/synfig/surface.cpp +++ b/synfig-core/src/synfig/surface.cpp @@ -317,7 +317,10 @@ CairoSurface::set_cairo_surface(cairo_surface_t *cs) { if(cs==NULL) { - synfig::error("CairoSruface received a NULL cairo_surface_t"); + if(is_mapped()) + unmap_cairo_image(); + cairo_surface_destroy(cs_); + cs_=NULL; return; } if(cairo_surface_status(cs)) @@ -327,8 +330,9 @@ CairoSurface::set_cairo_surface(cairo_surface_t *cs) } else { - if(cs_!=NULL) - cairo_surface_destroy(cs_); + if(is_mapped()) + unmap_cairo_image(); + cairo_surface_destroy(cs_); cs_=cairo_surface_reference(cs); } } diff --git a/synfig-core/src/synfig/surface.h b/synfig-core/src/synfig/surface.h index 4650a22..70b38a0 100644 --- a/synfig-core/src/synfig/surface.h +++ b/synfig-core/src/synfig/surface.h @@ -163,6 +163,9 @@ public: // by this surface class. // When the CairoSurface instance is destructed the reference counter of the // cairo_surface_t shoud be decreased. + // It is also possible to detach the cairo surface passing NULL as argument. + // If the cairo surface is mapped at the time of call this function, then + // it is unmaped first. void set_cairo_surface(cairo_surface_t *cs); // Returns an increased reference pointer of the surface. The receiver is responsible // of destroy the surface once referenced. ------------------------------------------------------------------------------ Keep yourself connected to Go Parallel: VERIFY Test and improve your parallel project with help from experts and peers. http://goparallel.sourceforge.net _______________________________________________ Synfig-devl mailing list Synfig-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synfig-devl