Re: Getting out of HTEventList_loop()

> 
> 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 UTC