hhctrl.ocx: Don't insert content item that could not be merged.

This commit is contained in:
Jacek Caban 2007-04-25 15:37:36 +02:00 committed by Alexandre Julliard
parent ce3fa8e861
commit b2aae66f1a
1 changed files with 26 additions and 18 deletions

View File

@ -32,6 +32,24 @@ typedef enum {
INSERT_CHILD
} insert_type_t;
static void free_content_item(ContentItem *item)
{
ContentItem *next;
while(item) {
next = item->next;
free_content_item(item->child);
hhctrl_free(item->name);
hhctrl_free(item->local);
hhctrl_free(item->merge.chm_file);
hhctrl_free(item->merge.chm_index);
item = next;
}
}
typedef struct {
char *buf;
int size;
@ -207,6 +225,9 @@ static ContentItem *insert_item(ContentItem *item, ContentItem *new_item, insert
if(!item)
return new_item;
if(!new_item)
return item;
switch(insert_type) {
case INSERT_NEXT:
item->next = new_item;
@ -265,6 +286,11 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
}else {
WARN("Could not get %s::%s stream\n", debugstr_w(item->merge.chm_file),
debugstr_w(item->merge.chm_file));
if(!item->name) {
free_content_item(item);
item = NULL;
}
}
}
@ -411,24 +437,6 @@ void InitContent(HHInfo *info)
fill_content_tree(info->tabs[TAB_CONTENTS].hwnd, NULL, info->content);
}
static void free_content_item(ContentItem *item)
{
ContentItem *next;
while(item) {
next = item->next;
free_content_item(item->child);
hhctrl_free(item->name);
hhctrl_free(item->local);
hhctrl_free(item->merge.chm_file);
hhctrl_free(item->merge.chm_index);
item = next;
}
}
void ReleaseContent(HHInfo *info)
{
free_content_item(info->content);