delete surface when created from gpixmap
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 1 Nov 2006 23:51:15 +0000 (23:51 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 1 Nov 2006 23:51:15 +0000 (23:51 +0000)
lib/gdi/gpixmap.cpp

index c3d2cc3..1ecb83d 100644 (file)
@@ -538,13 +538,17 @@ DEFINE_REF(gPixmap);
 
 gPixmap::~gPixmap()
 {
+       if (must_delete_surface)
+               delete surface;
 }
 
-gPixmap::gPixmap(gSurface *surface): surface(surface)
+gPixmap::gPixmap(gSurface *surface)
+       :surface(surface), must_delete_surface(false)
 {
 }
 
 gPixmap::gPixmap(eSize size, int bpp, int accel)
+       :must_delete_surface(true)
 {
        surface = new gSurface(size, bpp, accel);
 }