Commit 8e1e331a authored by Morten Welinder's avatar Morten Welinder

Bring back memory leaking to an acceptable level.

parent 0410b4ff
1999-07-05 Morten Welinder <terra@diku.dk>
* src/expr.c (value_array_resize): Shined up, fixed, not tested.
* src/print-info.c (print_hf_new): Constify.
(print_hf_free): Fix leaks.
* src/workbook.c (workbook_do_destroy): Fix leak.
* src/style.c (style_shutdown): Unref out fonts.
* src/sheet.c (sheet_start_editing_at_cursor): Doc fix.
1999-07-05 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c, src/dialog-analysis-tools.c,
......
1999-07-05 Morten Welinder <terra@diku.dk>
* src/expr.c (value_array_resize): Shined up, fixed, not tested.
* src/print-info.c (print_hf_new): Constify.
(print_hf_free): Fix leaks.
* src/workbook.c (workbook_do_destroy): Fix leak.
* src/style.c (style_shutdown): Unref out fonts.
* src/sheet.c (sheet_start_editing_at_cursor): Doc fix.
1999-07-05 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c, src/dialog-analysis-tools.c,
......
1999-07-05 Morten Welinder <terra@diku.dk>
* src/expr.c (value_array_resize): Shined up, fixed, not tested.
* src/print-info.c (print_hf_new): Constify.
(print_hf_free): Fix leaks.
* src/workbook.c (workbook_do_destroy): Fix leak.
* src/style.c (style_shutdown): Unref out fonts.
* src/sheet.c (sheet_start_editing_at_cursor): Doc fix.
1999-07-05 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c, src/dialog-analysis-tools.c,
......
1999-07-05 Morten Welinder <terra@diku.dk>
* src/expr.c (value_array_resize): Shined up, fixed, not tested.
* src/print-info.c (print_hf_new): Constify.
(print_hf_free): Fix leaks.
* src/workbook.c (workbook_do_destroy): Fix leak.
* src/style.c (style_shutdown): Unref out fonts.
* src/sheet.c (sheet_start_editing_at_cursor): Doc fix.
1999-07-05 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/analysis-tools.c, src/dialog-analysis-tools.c,
......
1999-07-05 Morten Welinder <terra@diku.dk>
* ms-excel-read.c (biff_shared_formula_new): Constify. Copy data
because it seems it can be freed underneath us.
(biff_shared_formula_destroy): Consequently free data.
(ms_excel_workbook_destroy): Free global strings.
(ms_excel_palette_destroy): Fix leak.
* ms-excel-read.c (ms_excel_read_supporting_wb): Warning killer.
(ms_excel_read_workbook): Ditto. Fill in some code page info.
(ms_excel_read_cell): Ditto.
......
......@@ -217,13 +217,17 @@ biff_get_error_text (const guint8 err)
}
static BiffSharedFormula *
biff_shared_formula_new (guint16 col, guint16 row, guint8 *data,
biff_shared_formula_new (guint16 col, guint16 row, const guint8 *data,
guint32 data_len)
{
BiffSharedFormula *sf = g_new (BiffSharedFormula, 1);
sf->key.col = col;
sf->key.row = row;
sf->data = data;
if (data_len > 0) {
sf->data = g_malloc (data_len);
memcpy (sf->data, data, data_len);
} else
sf->data = NULL;
sf->data_len = data_len;
return sf;
}
......@@ -231,6 +235,7 @@ biff_shared_formula_new (guint16 col, guint16 row, guint8 *data,
static gboolean
biff_shared_formula_destroy (gpointer key, BiffSharedFormula *sf, gpointer userdata)
{
g_free (sf->data);
g_free (sf);
return 1;
}
......@@ -846,6 +851,7 @@ ms_excel_palette_destroy (ExcelPalette *pal)
for (lp=0;lp<pal->length;lp++)
if (pal->gnum_cols[lp])
style_color_unref (pal->gnum_cols[lp]);
g_free (pal->gnum_cols);
g_free (pal);
}
......@@ -1651,6 +1657,13 @@ ms_excel_workbook_destroy (ExcelWorkbook *wb)
if (wb->extern_sheets)
g_free (wb->extern_sheets);
if (wb->global_strings) {
int i;
for (i = 0; i < wb->global_string_max; i++)
g_free (wb->global_strings[i]);
g_free (wb->global_strings);
}
g_free (wb);
}
......
......@@ -961,8 +961,8 @@ ms_excel_parse_formula (ExcelSheet *sheet, guint8 *mem,
value_array_set (v, lpx, lpy, set_val);
}
}
parse_list_push_raw (&stack, v);
really_duff:
parse_list_push_raw (&stack, v);
break;
}
case FORMULA_PTG_FUNC:
......
......@@ -858,27 +858,24 @@ value_array_resize (Value *v, guint width, guint height)
newval = value_array_new (width, height);
if (width>v->v.array.x)
xcpy = v->v.array.x;
else
xcpy = width;
if (height>v->v.array.y)
ycpy = v->v.array.y;
else
ycpy = height;
xcpy = MIN (width, v->v.array.x);
ycpy = MIN (height, v->v.array.y);
for (x = 0; x < xcpy; x++)
for (y = 0; y < ycpy; y++)
for (y = 0; y < ycpy; y++) {
value_array_set (newval, x, y, v->v.array.vals[x][y]);
v->v.array.vals[x][y] = NULL;
}
tmp = v->v.array.vals;
v->v.array.vals = newval->v.array.vals;
newval->v.array.vals = tmp;
value_release (newval);
newval->v.array.x = v->v.array.x;
newval->v.array.y = v->v.array.y;
v->v.array.x = width;
v->v.array.y = height;
value_release (newval);
}
void
......
......@@ -14,7 +14,8 @@
#include "print-info.h"
PrintHF *
print_hf_new (char *left_side_format, char *middle_format, char *right_side_format)
print_hf_new (const char *left_side_format, const char *middle_format,
const char *right_side_format)
{
PrintHF *format;
......@@ -36,7 +37,10 @@ void
print_hf_free (PrintHF *print_hf)
{
g_return_if_fail (print_hf != NULL);
g_free (print_hf->left_format);
g_free (print_hf->middle_format);
g_free (print_hf->right_format);
g_free (print_hf);
}
......@@ -47,7 +51,7 @@ print_info_free (PrintInformation *pi)
print_hf_free (pi->header);
print_hf_free (pi->footer);
g_free (pi);
}
......
......@@ -96,9 +96,9 @@ void print_info_save (PrintInformation *pi);
void print_info_free (PrintInformation *pi);
PrintHF *print_hf_new (char *left_side_format,
char *middle_format,
char *right_side_format);
PrintHF *print_hf_new (const char *left_side_format,
const char *middle_format,
const char *right_side_format);
void print_hf_free (PrintHF *print_hf);
const char *unit_name_get_short_name (UnitName name);
......
......@@ -984,6 +984,20 @@ sheet_load_cell_val (Sheet *sheet)
gtk_entry_set_text (entry, "");
}
/**
* sheet_start_editing_at_cursor:
*
* @sheet: The sheet to be edited.
* @blankp: If true, erase current cell contents first. If false, leave the
* contents alone.
* @cursorp: If true, create an editing cursor in the sheet itself. (If
* false, the text will be editing in the edit box above the sheet,
* but this is not handled by this function.)
*
* Initiate editing of a cell in the sheet. Note that we have two modes of
* editing: (1) in-cell editing when you just start typing, and (2) above-
* sheet editing when you hit F2.
*/
void
sheet_start_editing_at_cursor (Sheet *sheet, gboolean blankp, gboolean cursorp)
{
......@@ -1020,7 +1034,7 @@ sheet_start_editing_at_cursor (Sheet *sheet, gboolean blankp, gboolean cursorp)
/**
* sheet_update_controls:
*
* This routine is ran every time the seleciton has changed. It checks
* This routine is ran every time the selection has changed. It checks
* what the status of various toolbar feedback controls should be
*/
static void
......
......@@ -768,8 +768,11 @@ style_shutdown (void)
}
#endif
style_font_unref (gnumeric_default_font);
gnumeric_default_font = NULL;
style_font_unref (gnumeric_default_bold_font);
gnumeric_default_bold_font = NULL;
style_font_unref (gnumeric_default_italic_font);
gnumeric_default_italic_font = NULL;
g_hash_table_destroy (style_format_hash);
......
......@@ -286,9 +286,15 @@ workbook_do_destroy (Workbook *wb)
g_list_free (sheets);
}
if (wb->clipboard_contents)
if (wb->clipboard_contents) {
clipboard_release (wb->clipboard_contents);
wb->clipboard_contents = NULL;
wb->clipboard_contents = NULL;
}
if (wb->print_info) {
print_info_free (wb->print_info);
wb->print_info = NULL;
}
/* Remove ourselves from the list of workbooks. */
workbook_list = g_list_remove (workbook_list, wb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment