Fixed a memory leak (another)!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16437 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -473,9 +473,8 @@ _BStyleBuffer_::operator[](int32 index) const
|
|||||||
run.style = fNullStyle;
|
run.style = fNullStyle;
|
||||||
} else {
|
} else {
|
||||||
STEStyleRunDesc* runDesc = fStyleRunDesc[index];
|
STEStyleRunDesc* runDesc = fStyleRunDesc[index];
|
||||||
const STEStyleRecord* record = fStyleRecord[runDesc->index];
|
|
||||||
run.offset = runDesc->offset;
|
run.offset = runDesc->offset;
|
||||||
run.style = record->style;
|
run.style = fStyleRecord[runDesc->index]->style;
|
||||||
}
|
}
|
||||||
|
|
||||||
return run;
|
return run;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku Inc.
|
* Copyright 2001-2006, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -69,7 +69,7 @@ struct flattened_text_run {
|
|||||||
uint8 green;
|
uint8 green;
|
||||||
uint8 blue;
|
uint8 blue;
|
||||||
uint8 alpha; /* 255 == opaque */
|
uint8 alpha; /* 255 == opaque */
|
||||||
uint16 _reserved_; /* 0 */
|
uint16 _reserved_; /* 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1642,24 +1642,22 @@ BTextView::SetRunArray(int32 startOffset, int32 endOffset, const text_run_array
|
|||||||
text_run_array *
|
text_run_array *
|
||||||
BTextView::RunArray(int32 startOffset, int32 endOffset, int32 *outSize) const
|
BTextView::RunArray(int32 startOffset, int32 endOffset, int32 *outSize) const
|
||||||
{
|
{
|
||||||
CALLED();
|
|
||||||
|
|
||||||
STEStyleRange* styleRange = fStyles->GetStyleRange(startOffset, endOffset - 1);
|
STEStyleRange* styleRange = fStyles->GetStyleRange(startOffset, endOffset - 1);
|
||||||
if (styleRange == NULL)
|
if (styleRange == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
text_run_array *res = AllocRunArray(styleRange->count, outSize);
|
text_run_array *runArray = AllocRunArray(styleRange->count, outSize);
|
||||||
|
if (runArray != NULL) {
|
||||||
if (!res)
|
for (int32 i = 0; i < runArray->count; i++) {
|
||||||
return NULL;
|
runArray->runs[i].offset = styleRange->runs[i].offset;
|
||||||
|
runArray->runs[i].font = styleRange->runs[i].style.font;
|
||||||
for (int32 i = 0; i < res->count; i++) {
|
runArray->runs[i].color = styleRange->runs[i].style.color;
|
||||||
res->runs[i].offset = styleRange->runs[i].offset;
|
}
|
||||||
res->runs[i].font = &styleRange->runs[i].style.font;
|
|
||||||
res->runs[i].color = styleRange->runs[i].style.color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
free(styleRange);
|
||||||
|
|
||||||
|
return runArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user