[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/koffice/2.0/koffice/krita/plugins/paintops/libbrush
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2009-04-23 11:14:01
Message-ID: 1240485241.834933.32616.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 958061 by rempt:

CCBUG:190012 Crash when selecting a gbr or gih brush for the second time

We now keep a shadow list of all the brushes wrapped in a shared ptr
to avoid having the refcount go down to zero and the resource being
deleted. This is a bit tricky & ugly, but it does work around the problem
that we cannot put shared pointers into a resource server

 M  +5 -0      kis_brush_server.cpp  
 M  +2 -1      kis_brush_server.h  


--- branches/koffice/2.0/koffice/krita/plugins/paintops/libbrush/kis_brush_server.cpp #958060:958061
@@ -97,6 +97,11 @@
 {
     delete brushThread;
     brushThread = 0;
+
+    QList<KisBrush*> brushPointers = m_brushServer->resources();
+    foreach(KisBrush* brush, brushPointers) {
+        m_brushes << brush;
+    }
 }
 
 #include "kis_brush_server.moc"
--- branches/koffice/2.0/koffice/krita/plugins/paintops/libbrush/kis_brush_server.h #958060:958061
@@ -25,9 +25,9 @@
 #include <KoResourceServer.h>
 
 #include "krita_export.h"
+#include "kis_brush.h"
 
 class KoResource;
-class KisBrush;
 
 /**
  *
@@ -61,6 +61,7 @@
 private:
 
     QThread * brushThread;
+    QList<KisBrushSP> m_brushes; // to avoid the brushes being deleted.
 
 };
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic