aboutsummaryrefslogtreecommitdiffstats
path: root/taglib/toolkit
diff options
context:
space:
mode:
authorTsuda Kageyu <tsuda.kageyu@gmail.com>2017-02-08 17:45:46 +0900
committerTsuda Kageyu <tsuda.kageyu@gmail.com>2017-02-08 17:49:48 +0900
commit45ee18e206bea7bf6ea45da892211ec89e4f1b1d (patch)
treeaed593746299fbb6f02356e53373f1ad0be50962 /taglib/toolkit
parentdd4adf94ced99142dcddd7a943b7742a979ec402 (diff)
FilePrivate is responsible to delete a stream pointer instead of File.
Generally, TagLib leaves the Private classes to delete their members.
Diffstat (limited to 'taglib/toolkit')
-rw-r--r--taglib/toolkit/tfile.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp
index 897400b8..aff1684d 100644
--- a/taglib/toolkit/tfile.cpp
+++ b/taglib/toolkit/tfile.cpp
@@ -69,20 +69,22 @@ using namespace TagLib;
class File::FilePrivate
{
public:
- FilePrivate(IOStream *stream, bool owner);
+ FilePrivate(IOStream *stream, bool owner) :
+ stream(stream),
+ streamOwner(owner),
+ valid(true) {}
+
+ ~FilePrivate()
+ {
+ if(streamOwner)
+ delete stream;
+ }
IOStream *stream;
bool streamOwner;
bool valid;
};
-File::FilePrivate::FilePrivate(IOStream *stream, bool owner) :
- stream(stream),
- streamOwner(owner),
- valid(true)
-{
-}
-
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
@@ -99,8 +101,6 @@ File::File(IOStream *stream) :
File::~File()
{
- if(d->stream && d->streamOwner)
- delete d->stream;
delete d;
}