From 1fa1e7c66b7b0820b1994657ff2b1950eee82ac3 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 30 Apr 2008 18:23:46 +0000 Subject: [PATCH] Avoid a crash on exit (Mac and Windows). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24566 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiClipboard.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index 7fb2a75b43..ce76d0fed3 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -170,7 +170,7 @@ QVector QWindowsMimeMetafile::formatsForMime( return formats; } -static std::auto_ptr metafileWindowsMime; +static QWindowsMimeMetafile * metafileWindowsMime; #endif // Q_WS_WIN @@ -235,7 +235,7 @@ QList QMacPasteboardMimeGraphics::convertFromMime(QString const & mi return ret; } -static std::auto_ptr graphicsPasteboardMime; +static QMacPasteboardMimeGraphics * graphicsPasteboardMime; #endif // Q_WS_MACX @@ -248,21 +248,31 @@ GuiClipboard::GuiClipboard() on_dataChanged(); #ifdef Q_WS_MACX - if (!graphicsPasteboardMime.get()) - graphicsPasteboardMime.reset(new QMacPasteboardMimeGraphics()); + if (!graphicsPasteboardMime) + graphicsPasteboardMime = new QMacPasteboardMimeGraphics(); #endif // Q_WS_MACX #ifdef Q_WS_WIN - if (!metafileWindowsMime.get()) - metafileWindowsMime.reset(new QWindowsMimeMetafile()); + if (!metafileWindowsMime) + metafileWindowsMime = new QWindowsMimeMetafile(); #endif // Q_WS_WIN } GuiClipboard::~GuiClipboard() { +#ifdef Q_WS_WIN + if (metafileWindowsMime) { + delete metafileWindowsMime; + metafileWindowsMime = 0; + } +#endif // Q_WS_WIN #ifdef Q_WS_MACX closeAllLinkBackLinks(); + if (graphicsPasteboardMime) { + delete graphicsPasteboardMime; + graphicsPasteboardMime = 0; + } #endif // Q_WS_MACX }