Change lo_AppendFloatInLineList to use lo_NewElement instead of XP_NEW_ZAP. This fixes a memory leak, since now it's allocated from the arena instead of just random heap space.

This commit is contained in:
toshok%netscape.com 1998-07-31 03:22:35 +00:00
Родитель 0a2d7a6329
Коммит ec01c58ae2
5 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -902,7 +902,7 @@ lo_FinishEmbed(MWContext *context, lo_DocState *state, LO_EmbedStruct *embed)
embed->objTag.next = state->float_list;
state->float_list = (LO_Element *)embed;
lo_AppendFloatInLineList(state, (LO_Element*)embed, NULL);
lo_AppendFloatInLineList(context, state, (LO_Element*)embed, NULL);
lo_LayoutFloatEmbed(context, state, embed, TRUE);

Просмотреть файл

@ -2243,7 +2243,7 @@ lo_FinishImage(MWContext *context, lo_DocState *state, LO_ImageStruct *image)
* Append a dummy layout element in the line list. When the relayout engine
* will see this dummy element, it will call lo_LayoutFloatImage()
*/
lo_AppendFloatInLineList( state, (LO_Element *) image, NULL );
lo_AppendFloatInLineList(context, state, (LO_Element *) image, NULL );
lo_LayoutFloatImage( context, state, image, TRUE);

Просмотреть файл

@ -650,7 +650,7 @@ lo_FinishJavaApp(MWContext *context, lo_DocState *state,
java_app->objTag.next = state->float_list;
state->float_list = (LO_Element *)java_app;
lo_AppendFloatInLineList(state, (LO_Element*)java_app, NULL);
lo_AppendFloatInLineList(context, state, (LO_Element*)java_app, NULL);
lo_LayoutFloatJavaApp(context, state, java_app, TRUE);

Просмотреть файл

@ -1367,7 +1367,7 @@ extern void lo_FillInLineFeed( MWContext *context, lo_DocState *state, int32 bre
extern void lo_UpdateStateWhileFlushingLine( MWContext *context, lo_DocState *state );
extern void lo_AppendLineFeed( MWContext *context, lo_DocState *state, LO_LinefeedStruct *linefeed, int32 breaking, Bool updateFE );
extern void lo_UpdateStateAfterFlushingLine( MWContext *context, lo_DocState *state, LO_LinefeedStruct *linefeed, Bool inRelayout );
extern void lo_AppendFloatInLineList( lo_DocState *state, LO_Element *ele, LO_Element *restOfLine);
extern void lo_AppendFloatInLineList( MWContext *context, lo_DocState *state, LO_Element *ele, LO_Element *restOfLine);
/*
* Common code for layout and relayout of tables

Просмотреть файл

@ -1652,10 +1652,12 @@ void lo_rl_AppendLinefeedAndFlushLine( MWContext *context, lo_DocState *state, L
* Append a dummy layout element in the line list. When the relayout engine
* will see this dummy element, it will call lo_LayoutFloat{Image,JavaApp,Embed}()
*/
void lo_AppendFloatInLineList( lo_DocState *state, LO_Element *ele, LO_Element *restOfLine)
void lo_AppendFloatInLineList(MWContext *context,
lo_DocState *state, LO_Element *ele, LO_Element *restOfLine)
{
LO_Element *eptr;
LO_FloatStruct *float_dummy = XP_NEW_ZAP(LO_FloatStruct);
LO_FloatStruct *float_dummy = (LO_FloatStruct*)lo_NewElement(context, state,
LO_FLOAT, NULL, 0);
float_dummy->float_ele = ele;
float_dummy->lo_any.type = LO_FLOAT;
float_dummy->lo_any.ele_id = NEXT_ELEMENT;