From 87c48374b733f2df0d32bdf1e346205c03fa989c Mon Sep 17 00:00:00 2001 From: kojima Date: Sat, 15 May 1999 19:16:12 +0000 Subject: [PATCH] fixed crash bug --- WINGs/wtabview.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WINGs/wtabview.c b/WINGs/wtabview.c index 2a9450cb..e4465ad8 100644 --- a/WINGs/wtabview.c +++ b/WINGs/wtabview.c @@ -142,11 +142,13 @@ WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item) if (tPtr->maxItems == tPtr->itemCount) { WMTabViewItem **items; - items = wrealloc(tPtr->items, tPtr->maxItems + 10); + items = wrealloc(tPtr->items, + sizeof(WMTabViewItem*) * (tPtr->maxItems + 10)); if (!items) { wwarning("out of memory allocating memory for tabview"); return; } + memset(&items[tPtr->maxItems], 0, sizeof(WMTabViewItem*) * 10); tPtr->items = items; tPtr->maxItems += 10; } @@ -507,6 +509,7 @@ destroyTabView(TabView *tPtr) int i; for (i = 0; i < tPtr->itemCount; i++) { + WMSetTabViewItemView(tPtr->items[i], NULL); WMDestroyTabViewItem(tPtr->items[i]); } free(tPtr->items);