* 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:
@@ -427,6 +427,7 @@ Icon::GetData(uint8** _data, size_t* _size) const
|
|||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
memcpy(data, fData, fSize);
|
||||||
*_data = data;
|
*_data = data;
|
||||||
*_size = fSize;
|
*_size = fSize;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -1149,17 +1150,18 @@ IconView::_AddOrEditIcon()
|
|||||||
if (icon->HasData()) {
|
if (icon->HasData()) {
|
||||||
uint8* data;
|
uint8* data;
|
||||||
size_t size;
|
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);
|
message.AddData("icon data", B_VECTOR_ICON_TYPE, data, size);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: somehow figure out how names of objects in the icon
|
// TODO: somehow figure out how names of objects in the icon
|
||||||
// can be preserved. Maybe in a second (optional) attribute
|
// can be preserved. Maybe in a second (optional) attribute
|
||||||
// where ever a vector icon attribute is present?
|
// 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user