]> git.lyx.org Git - features.git/commitdiff
fix memory leak, using boost::shared_ptr because std::auto_ptr as no value semantic
authorPeter Kümmel <syntheticpp@gmx.net>
Sat, 19 Apr 2008 09:36:19 +0000 (09:36 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Sat, 19 Apr 2008 09:36:19 +0000 (09:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24344 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiClipboard.cpp

index 839bd021297f1cd54ee5d953c397a6352166e268..a7b1e307b787cb259ce5b9d14253189072837de0 100644 (file)
@@ -53,6 +53,8 @@
 #include <objidl.h>
 #endif // Q_WS_WIN
 
+#include <boost/shared_ptr.hpp>
+
 #include <map>
 
 using namespace std;
@@ -169,7 +171,7 @@ QVector<FORMATETC> QWindowsMimeMetafile::formatsForMime(
        return formats;
 }
 
-static QWindowsMimeMetafile * metafileWindowsMime;
+static boost::shared_ptr<QWindowsMimeMetafile> metafileWindowsMime;
 
 #endif // Q_WS_WIN
 
@@ -234,7 +236,7 @@ QList<QByteArray> QMacPasteboardMimeGraphics::convertFromMime(QString const & mi
        return ret;
 }
 
-static QMacPasteboardMimeGraphics * graphicsPasteboardMime;
+static boost::shared_ptr<QMacPasteboardMimeGraphics> graphicsPasteboardMime;
 
 #endif // Q_WS_MACX
 
@@ -248,12 +250,16 @@ GuiClipboard::GuiClipboard()
        
 #ifdef Q_WS_MACX
        if (!graphicsPasteboardMime)
-               graphicsPasteboardMime = new QMacPasteboardMimeGraphics();
+               graphicsPasteboardMime = 
+                       boost::shared_ptr<QMacPasteboardMimeGraphics>
+                               (new QMacPasteboardMimeGraphics());
 #endif // Q_WS_MACX
 
 #ifdef Q_WS_WIN
        if (!metafileWindowsMime)
-               metafileWindowsMime = new QWindowsMimeMetafile();
+               metafileWindowsMime = 
+                       boost::shared_ptr<QWindowsMimeMetafile>
+                               (new QWindowsMimeMetafile());
 #endif // Q_WS_WIN
 }