Author: Carlos Lopez <[email protected]>
Date:   Mon Mar  4 19:54:03 2013 +0100

When destroying Preview, remove the references of the surfaces first.
When removing the surface references check if the pointer has been initialized 
to NULL first.
Initialize the cairo surface pointer to NULL when working with normal render.

---

 synfig-studio/src/gui/preview.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/synfig-studio/src/gui/preview.cpp 
b/synfig-studio/src/gui/preview.cpp
index 7205711..7096c44 100644
--- a/synfig-studio/src/gui/preview.cpp
+++ b/synfig-studio/src/gui/preview.cpp
@@ -223,6 +223,7 @@ void studio::Preview::set_canvasview(const 
studio::CanvasView::LooseHandle &h)
 
 studio::Preview::~Preview()
 {
+       clear(); // we need this to remove the cairo_surface references
        signal_destroyed_(this); //tell anything that attached to us, we're 
dying
 }
 
@@ -296,7 +297,8 @@ void studio::Preview::clear()
 {
        FlipBook::iterator it;
        for(it=frames.begin(); it!=frames.end(); it++)
-               cairo_surface_destroy(it->surface);
+               if(it->surface)
+                       cairo_surface_destroy(it->surface);
        frames.clear();
 }
 
@@ -332,6 +334,7 @@ void studio::Preview::frame_finish(const Preview_Target 
*targ)
 
        //load time
        fe.t = time;
+       fe.surface=NULL;
        //uses and manages the memory for the buffer...
        //synfig::warning("Create a pixmap...");
        fe.buf =


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to