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:
@@ -774,6 +774,8 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
fUsurped(NULL)
|
fUsurped(NULL)
|
||||||
{
|
{
|
||||||
|
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||||
|
|
||||||
BMallocIO *mallocIO = new (std::nothrow) BMallocIO();
|
BMallocIO *mallocIO = new (std::nothrow) BMallocIO();
|
||||||
if (mallocIO == NULL)
|
if (mallocIO == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -784,8 +786,6 @@ ServerPicture::ServerPicture(const ServerPicture &picture)
|
|||||||
if (mallocIO->SetSize(size) < B_OK)
|
if (mallocIO->SetSize(size) < B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
|
||||||
|
|
||||||
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
picture.fData->ReadAt(0, const_cast<void *>(mallocIO->Buffer()), size);
|
||||||
|
|
||||||
PictureDataWriter::SetTo(fData);
|
PictureDataWriter::SetTo(fData);
|
||||||
@@ -800,6 +800,8 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
|||||||
fPictures(NULL),
|
fPictures(NULL),
|
||||||
fUsurped(NULL)
|
fUsurped(NULL)
|
||||||
{
|
{
|
||||||
|
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
||||||
|
|
||||||
fFile = new (std::nothrow) BFile(fileName, B_READ_WRITE);
|
fFile = new (std::nothrow) BFile(fileName, B_READ_WRITE);
|
||||||
if (fFile == NULL)
|
if (fFile == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -812,7 +814,6 @@ ServerPicture::ServerPicture(const char *fileName, const int32 &offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fData = offsetFile;
|
fData = offsetFile;
|
||||||
fToken = gTokenSpace.NewToken(kPictureToken, this);
|
|
||||||
|
|
||||||
PictureDataWriter::SetTo(fData);
|
PictureDataWriter::SetTo(fData);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user