From 62f80d9556e6877ac726559336aae780211c7060 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 20 Apr 2012 20:13:40 +0300 Subject: [PATCH] NowPlaying.dll: Applied a few fixes to TagLib --- Plugins/PluginNowPlaying/taglib/mpeg/id3v1/id3v1tag.cpp | 7 +++++-- .../taglib/mpeg/id3v2/id3v2framefactory.cpp | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Plugins/PluginNowPlaying/taglib/mpeg/id3v1/id3v1tag.cpp b/Plugins/PluginNowPlaying/taglib/mpeg/id3v1/id3v1tag.cpp index 4a1d69b2..1457c81b 100644 --- a/Plugins/PluginNowPlaying/taglib/mpeg/id3v1/id3v1tag.cpp +++ b/Plugins/PluginNowPlaying/taglib/mpeg/id3v1/id3v1tag.cpp @@ -51,7 +51,8 @@ public: static const StringHandler *stringHandler; }; -const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = new StringHandler; +static const StringHandler defaultStringHandler; +const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = &defaultStringHandler; //////////////////////////////////////////////////////////////////////////////// // StringHandler implementation @@ -189,7 +190,9 @@ void ID3v1::Tag::setTrack(uint i) void ID3v1::Tag::setStringHandler(const StringHandler *handler) { - delete TagPrivate::stringHandler; + if(TagPrivate::stringHandler != &defaultStringHandler) + delete TagPrivate::stringHandler; + TagPrivate::stringHandler = handler; } diff --git a/Plugins/PluginNowPlaying/taglib/mpeg/id3v2/id3v2framefactory.cpp b/Plugins/PluginNowPlaying/taglib/mpeg/id3v2/id3v2framefactory.cpp index 356d60d4..a1067acc 100644 --- a/Plugins/PluginNowPlaying/taglib/mpeg/id3v2/id3v2framefactory.cpp +++ b/Plugins/PluginNowPlaying/taglib/mpeg/id3v2/id3v2framefactory.cpp @@ -73,9 +73,8 @@ FrameFactory *FrameFactory::factory = 0; FrameFactory *FrameFactory::instance() { - if(!factory) - factory = new FrameFactory; - return factory; + static FrameFactory factory; + return &factory; } Frame *FrameFactory::createFrame(const ByteVector &data, bool synchSafeInts) const