Incorrect order in HTLibTerminate of HTLib.c?

Hello,

In HTLibTerminate(void) of HTLib.c a number of cleanup/delete functions
are called, in particular,

HTHost_deleteAll();
   followed by
HTChannel_deleteAll();

but I am wondering whether in fact
HTChannel_deleteAll() should be called BEFORE HTHost_deleteAll()

the reason I ask this is that I just debugged a situation
in my app in which if the user requests a URL to a server
that either isn't up or gets shutdown while in use
a normal and proper "Failed to connect" error occurs.

However, on shutdown of the app and within
the call to HTLibTerminate(void), I can get an unmapped memory
exception which is traced to the delete code in HTChannel_deleteAll()
requesting the use of the host associated with an apparently
still alive read channel which ends up
calling HTHost_getReadNet(HTHost * host) in HTHost.c

Seeing that the code currently does a HTHost_deleteAll before calling
HTChannel_deleteAll I reversed the calling of these two functions
and it eliminated the unmapped exception.

When HTHost_deleteAll() was added to HTLibTerminate do you think
someone just did not think that there are instances when
open channels might still need the host info around on their delete.
This seems to be the case I have found...

Anyone else ever see this or know of any problems with
reversing these two calls?

Thanks
Jeff

-- 

Received on Monday, 28 January 2002 16:44:05 UTC