[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev nested table leak
From: |
Thomas Dickey |
Subject: |
lynx-dev nested table leak |
Date: |
Fri, 10 Jan 2003 20:24:30 -0500 |
User-agent: |
Mutt/1.3.27i |
Here's a fix for the nested tables memory leak (will do more testing...)
--- GridText.c.orig Thu Jan 2 18:46:42 2003
+++ GridText.c Fri Jan 10 20:16:39 2003
@@ -386,6 +386,7 @@
int last_lineno_last_disp_partial;
#endif
STable_info * stbl;
+ HTList * enclosed_stbl;
HTkcode kcode; /* Kanji code? */
HTkcode specified_kcode; /* Specified Kanji code
*/
@@ -4737,8 +4738,10 @@
return FALSE;
}
CTRACE((tfp, "endStblTABLE: ok, will try.\n"));
+
ncols = Stbl_finishTABLE(me->stbl);
CTRACE((tfp, "endStblTABLE: ncols = %d.\n", ncols));
+
if (ncols > 0) {
lines_changed = HText_insertBlanksInStblLines(me, ncols);
CTRACE((tfp, "endStblTABLE: changed %d lines, done.\n", lines_changed));
@@ -4749,19 +4752,41 @@
NumOfLines_partial -= lines_changed; /* fake */
#endif /* DISP_PARTIAL */
}
+
#ifdef EXP_NESTED_TABLES
if (nested_tables) {
enclosing = Stbl_get_enclosing(me->stbl);
me->last_anchor_before_stbl = Stbl_get_last_anchor_before(me->stbl);
- } else
-#endif
- Stbl_free(me->stbl);
-#ifdef EXP_NESTED_TABLES
- if (nested_tables)
+ if (enclosing == NULL) {
+ Stbl_free(me->stbl);
+ if (me->enclosed_stbl != NULL) {
+ HTList *list = me->enclosed_stbl;
+ STable_info *stbl;
+ while (NULL != (stbl = (STable_info *)HTList_nextObject(list)))
{
+ Stbl_free(stbl);
+ }
+ HTList_delete(me->enclosed_stbl);
+ me->enclosed_stbl = NULL;
+ }
+ } else {
+ if (me->enclosed_stbl == NULL)
+ me->enclosed_stbl = HTList_new();
+ HTList_addObject(me->enclosed_stbl, me->stbl);
+ CTRACE((tfp, "FIXME-STBL %p\n", me->stbl));
+ }
me->stbl = enclosing;
- else
-#endif
+ } else {
+ Stbl_free(me->stbl);
+ me->stbl = NULL;
+ }
+#else
+ Stbl_free(me->stbl);
me->stbl = NULL;
+#endif
+
+ CTRACE((tfp, "endStblTABLE: have%s enclosing table (%p)\n",
+ enclosing == 0 ? " NO" : "", enclosing));
+
return enclosing != 0;
}
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
- lynx-dev nested table leak,
Thomas Dickey <=