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 c3d2cc31b977ef844987e2595a02008b3ae3d724..1ecb83d3f18a9359cc42d0feb846fcf12c20c4b8 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);
 }