Fix leaking of type references.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42381 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b6c5f46896
commit
90753bf805
|
@ -319,11 +319,14 @@ BMessageValueNode::CreateChildren()
|
||||||
type_code type;
|
type_code type;
|
||||||
int32 count;
|
int32 count;
|
||||||
Type* fieldType = NULL;
|
Type* fieldType = NULL;
|
||||||
|
BReference<Type> typeRef;
|
||||||
for (int32 i = 0; fMessage.GetInfo(B_ANY_TYPE, i, &name, &type,
|
for (int32 i = 0; fMessage.GetInfo(B_ANY_TYPE, i, &name, &type,
|
||||||
&count) == B_OK; i++) {
|
&count) == B_OK; i++) {
|
||||||
fieldType = NULL;
|
fieldType = NULL;
|
||||||
|
|
||||||
_GetTypeForTypeCode(type, fieldType);
|
_GetTypeForTypeCode(type, fieldType);
|
||||||
|
if (fieldType != NULL)
|
||||||
|
typeRef.SetTo(fieldType, true);
|
||||||
|
|
||||||
BMessageFieldNodeChild* node = new(std::nothrow)
|
BMessageFieldNodeChild* node = new(std::nothrow)
|
||||||
BMessageFieldNodeChild(this,
|
BMessageFieldNodeChild(this,
|
||||||
|
@ -603,6 +606,8 @@ BMessageValueNode::BMessageFieldNode::CreateChildren()
|
||||||
status_t error = fParent->_GetTypeForTypeCode(fFieldType, type);
|
status_t error = fParent->_GetTypeForTypeCode(fFieldType, type);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
BReference<Type> typeRef(type, true);
|
||||||
for (int32 i = 0; i < fFieldCount; i++) {
|
for (int32 i = 0; i < fFieldCount; i++) {
|
||||||
BMessageFieldNodeChild* child = new(std::nothrow)
|
BMessageFieldNodeChild* child = new(std::nothrow)
|
||||||
BMessageFieldNodeChild(fParent, type, fName, fFieldType, fFieldCount, i);
|
BMessageFieldNodeChild(fParent, type, fName, fFieldType, fFieldCount, i);
|
||||||
|
|
Loading…
Reference in New Issue