W3C home > Mailing lists > Public > www-lib@w3.org > April to June 1999

Re: Getting out of HTEventList_loop()

From: Raffaele Sena <raff@nuvomedia.com>
Date: Wed, 9 Jun 1999 17:37:07 -0700
Message-ID: <01cf01beb2d9$5ebdd8a0$52c0a8c0@nuvomedia.com>
To: "Michael Saunders" <michael@amtec.com>, <www-lib@w3.org>, <gstreet@vninet.com>
> 
> 3) I tried reinitializing the library and cleaning it up completely
> before and after each request but I discovered that if perform
> several subsequent download and uploads using HTLoadToFile and
> HTPutDocumentAnchor the library crashes.
> 
    I use the library in this way and it works for me (I use HTLoadAnchor
    and never tried HTPutDocumentAnchor though).

    My application starts a request that can recursively start
    other requests. When these operation are terminated (or I
    interrupt the transfer) I shut down the library. Then I
    can start other requests by reinitializing the library.

    This is how I shut down the library:

       /* Remove after filter */
        HTNet_deleteAfter(terminate_handler);

        HTAlert_deleteAll();
        HTProxy_deleteAll();

        HTNet_killAll();

        {
         HTList * documents = HTList_new();
         void * doc;

         HTAnchor_deleteAll(documents);

         while ((doc = HTList_removeFirstObject(documents)) != NULL)
             HT_FREE(doc);

         HTList_delete(documents);
        }

        /* Terminate libwww */
        HTProfile_delete();

    The HTAnchor_deleteAll() and the following loop is because
    I need to release my data structures linked to the anchors.
    For this I had to add HTNet_killAll() before, otherwise when
    called inside HTProfile_delete() it would try to access to
    some structures already released but still pointed by something
    else.

    The library is not perfect in this area. I fixed a few bugs that
    I found on the way, but now I seem to have reached a point where
    it work fine for me.

    Maybe you found something else that need to be fixed. It could
    be worth to keep working on that area and reporting your finding.

Thanks,

    Raffaele
Received on Wednesday, 9 June 1999 20:36:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:29 GMT