mirror of
https://github.com/taglib/taglib.git
synced 2025-07-19 13:34:19 -04:00
FilePrivate is responsible to delete a stream pointer instead of File.
Generally, TagLib leaves the Private classes to delete their members.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user