* Sending uninitialized buffers to Icon-O-Matic is sure fun, but it actually

caused Icon-O-Matic to refuse to work with us :)
* only call free() when the data has actually been allocated.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-11-17 15:00:26 +00:00
parent 13417161c8
commit dd778cd92b
1 changed files with 6 additions and 4 deletions

View File

@ -427,6 +427,7 @@ Icon::GetData(uint8** _data, size_t* _size) const
if (data == NULL)
return B_NO_MEMORY;
memcpy(data, fData, fSize);
*_data = data;
*_size = fSize;
return B_OK;
@ -1149,17 +1150,18 @@ IconView::_AddOrEditIcon()
if (icon->HasData()) {
uint8* data;
size_t size;
if (icon->GetData(&data, &size) == B_OK)
if (icon->GetData(&data, &size) == B_OK) {
message.AddData("icon data", B_VECTOR_ICON_TYPE, data, size);
free(data);
}
// TODO: somehow figure out how names of objects in the icon
// can be preserved. Maybe in a second (optional) attribute
// where ever a vector icon attribute is present?
free(data);
}
}
be_roster->Launch("application/x-vnd.Haiku-icon_o_matic", &message);
be_roster->Launch("application/x-vnd.haiku-icon_o_matic", &message);
#endif
}