From 1833d310afa6775933e7589890b5a40ce4ffaac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Sat, 19 Apr 2008 09:36:19 +0000 Subject: [PATCH] fix memory leak, using boost::shared_ptr because std::auto_ptr as no value semantic git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24344 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiClipboard.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index 839bd02129..a7b1e307b7 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -53,6 +53,8 @@ #include #endif // Q_WS_WIN +#include + #include using namespace std; @@ -169,7 +171,7 @@ QVector QWindowsMimeMetafile::formatsForMime( return formats; } -static QWindowsMimeMetafile * metafileWindowsMime; +static boost::shared_ptr metafileWindowsMime; #endif // Q_WS_WIN @@ -234,7 +236,7 @@ QList QMacPasteboardMimeGraphics::convertFromMime(QString const & mi return ret; } -static QMacPasteboardMimeGraphics * graphicsPasteboardMime; +static boost::shared_ptr graphicsPasteboardMime; #endif // Q_WS_MACX @@ -248,12 +250,16 @@ GuiClipboard::GuiClipboard() #ifdef Q_WS_MACX if (!graphicsPasteboardMime) - graphicsPasteboardMime = new QMacPasteboardMimeGraphics(); + graphicsPasteboardMime = + boost::shared_ptr + (new QMacPasteboardMimeGraphics()); #endif // Q_WS_MACX #ifdef Q_WS_WIN if (!metafileWindowsMime) - metafileWindowsMime = new QWindowsMimeMetafile(); + metafileWindowsMime = + boost::shared_ptr + (new QWindowsMimeMetafile()); #endif // Q_WS_WIN }