assign a token to the ServerPicture before anything else. If something fails to initialize, we can still search the picture via token
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27593 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6d4673085d
commit
632f1504a8
@ -774,6 +774,8 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
||||
fPictures(NULL),
|
||||
fUsurped(NULL)
|
||||
{
|
||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||
|
||||
BMallocIO *mallocIO = new (std::nothrow) BMallocIO();
|
||||
if (mallocIO == NULL)
|
||||
return;
|
||||
@ -784,8 +786,6 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
||||
if (mallocIO->SetSize(size) < B_OK)
|
||||
return;
|
||||
|
||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||
|
||||
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
||||
|
||||
PictureDataWriter::SetTo(fData);
|
||||
@ -800,6 +800,8 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
||||
fPictures(NULL),
|
||||
fUsurped(NULL)
|
||||
{
|
||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||
|
||||
fFile = new (std::nothrow) BFile(fileName, B_READ_WRITE);
|
||||
if (fFile == NULL)
|
||||
return;
|
||||
@ -812,7 +814,6 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
||||
}
|
||||
|
||||
fData = offsetFile;
|
||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||
|
||||
PictureDataWriter::SetTo(fData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user