Commit 9ad2ec02 authored by Michael Meeks's avatar Michael Meeks
Browse files

fix possible problem with realizing objects in destroyed sheets,

Update for libole2's libtoolness
parent 115ab5ef
1999-09-25 Michael Meeks <michael@nuclecu.unam.mx>
* Makefile.am (ole_LDADD): use libole2.la
* ms-obj.c (ms_obj_realize): remove object destruction.
(ms_obj_destroy): add. (ms_excel_sheet_destroy_objs): Create.
(ms_excel_sheet_realize_objs): remove list free.
* ms-excel-read.c (ms_excel_read_sheet): add return type
to save possible cock-up. (ms_excel_read_workbook): only
realize objects if loaded OK.
1999-09-25 Michael Meeks <michael@nuclecu.unam.mx>
* ole.c (decompress_vba): an idea.
(dump_vba_module): + hooks.
1999-09-25 Michael Meeks <michael@nuclecu.unam.mx>
* ole.c (decompress_vba): remove unused + clean headers.
......
......@@ -45,7 +45,7 @@ ole_SOURCES = \
ole.c
ole_LDADD = \
libole2/libole2.a \
libole2/libole2.la \
$(GNOME_LIBDIR) \
$(GNOME_LIBS) \
$(INTLLIBS)
......
......@@ -2437,16 +2437,16 @@ ms_excel_read_selection (ExcelSheet *sheet, BiffQuery *q)
#endif
}
static void
static gboolean
ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
{
guint32 const blankSheetPos = q->streamPos + q->length + 4;
PrintInformation *pi;
g_return_if_fail (wb != NULL);
g_return_if_fail (sheet != NULL);
g_return_if_fail (sheet->gnum_sheet != NULL);
g_return_if_fail (sheet->gnum_sheet->print_info != NULL);
g_return_val_if_fail (wb != NULL, NULL);
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (sheet->gnum_sheet != NULL, NULL);
g_return_val_if_fail (sheet->gnum_sheet->print_info != NULL, NULL);
pi = sheet->gnum_sheet->print_info;
......@@ -2483,7 +2483,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
printf ("Serious error detaching sheet '%s'\n",
sheet->gnum_sheet->name);
}
return;
return TRUE;
break;
case BIFF_OBJ: /* See: ms-obj.c and S59DAD.HTM */
......@@ -2757,6 +2757,8 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
ms_excel_sheet_destroy (sheet);
sheet = NULL;
printf ("Error, hit end without EOF\n");
return FALSE;
}
Sheet *
......@@ -2951,8 +2953,9 @@ ms_excel_read_workbook (Workbook *workbook, MsOle *file)
{
ExcelSheet *sheet = ms_excel_workbook_get_sheet (wb, current_sheet);
ms_excel_sheet_set_version (sheet, ver->version);
ms_excel_read_sheet (sheet, q, wb);
ms_excel_sheet_realize_objs (sheet);
if (ms_excel_read_sheet (sheet, q, wb))
ms_excel_sheet_realize_objs (sheet);
ms_excel_sheet_destroy_objs (sheet);
current_sheet++;
}
} else if (ver->type == eBiffTChart)
......
......@@ -112,10 +112,17 @@ ms_obj_realize (MSObj *obj, ExcelWorkbook *wb, ExcelSheet *sheet)
break;
};
g_free (obj);
return FALSE;
}
static void
ms_obj_destroy (MSObj *obj)
{
if (obj) {
g_free (obj);
}
}
/**
* ms_excel_sheet_realize_objs:
* @sheet:
......@@ -132,6 +139,17 @@ ms_excel_sheet_realize_objs (ExcelSheet *sheet)
for (l = sheet->obj_queue; l; l = g_list_next (l))
ms_obj_realize (l->data, sheet->wb, sheet);
}
void
ms_excel_sheet_destroy_objs (ExcelSheet *sheet)
{
GList *l;
g_return_if_fail (sheet != NULL);
for (l = sheet->obj_queue; l; l = g_list_next (l))
ms_obj_destroy (l->data);
g_list_free (sheet->obj_queue);
sheet->obj_queue = NULL;
......
......@@ -6,6 +6,7 @@
*
* Author:
* Michael Meeks (michael@imaginator.com)
*
**/
#include "config.h"
......@@ -38,17 +39,19 @@ typedef struct
} MSObj;
gboolean ms_parse_object_anchor (int pos[4],
Sheet const * sheet, guint8 const * data);
Sheet const * sheet,
guint8 const * data);
gboolean ms_obj_realize(MSObj * obj,
ExcelWorkbook *wb, ExcelSheet * sheet);
void ms_excel_sheet_realize_objs (ExcelSheet *sheet);
void ms_excel_sheet_destroy_objs (ExcelSheet *sheet);
MSObj * ms_read_OBJ (BiffQuery *q,
ExcelWorkbook * wb, Sheet * sheet);
MSObj *ms_read_OBJ (BiffQuery *q,
ExcelWorkbook * wb, Sheet * sheet);
void ms_read_TXO (BiffQuery *q, ExcelWorkbook * wb);
void ms_read_TXO (BiffQuery *q, ExcelWorkbook * wb);
#endif /* GNUMERIC_MS_OBJ_H */
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