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
This commit is contained in:
Enrico Forestieri 2008-04-30 18:23:46 +00:00
parent ae0ec2fe71
commit 1fa1e7c66b

View File

@ -170,7 +170,7 @@ QVector<FORMATETC> QWindowsMimeMetafile::formatsForMime(
return formats;
}
static std::auto_ptr<QWindowsMimeMetafile> metafileWindowsMime;
static QWindowsMimeMetafile * metafileWindowsMime;
#endif // Q_WS_WIN
@ -235,7 +235,7 @@ QList<QByteArray> QMacPasteboardMimeGraphics::convertFromMime(QString const & mi
return ret;
}
static std::auto_ptr<QMacPasteboardMimeGraphics> 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
}