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

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 26 10:23:53 CDT 2007


Module: wine
Branch: master
Commit: b2aae66f1ab495480861f0e0b559739654d8f171
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b2aae66f1ab495480861f0e0b559739654d8f171

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr 25 15:37:36 2007 +0200

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

---

 dlls/hhctrl.ocx/content.c |   44 ++++++++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/dlls/hhctrl.ocx/content.c b/dlls/hhctrl.ocx/content.c
index c572baf..a34c853 100644
--- a/dlls/hhctrl.ocx/content.c
+++ b/dlls/hhctrl.ocx/content.c
@@ -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);




More information about the wine-cvs mailing list