Re: Incorrect order in HTLibTerminate of HTLib.c?

Hi Jeff,


I have tried to check if reversing the calls was obvious.
But I see that:
 1) HTHost_deleteAll() calls free_object which call HTChannel_delete
 2) HTChannel_deleteAll() does not directly calls HTHost_xxx function
 
Then I rather advice to let the calls in that order.

To maillist reader think about what can make the crash 
I suggest you provide
- global description of own program use the lib w3
  or which sample you've based it on
- how do you make the HTLibTerminate been called
- the stack call beetween HTChannel_deleteAll() and HTHost_getReadNet()
  for it is not obviuos reading the code

/m


Jeff Adams wrote:
> 
> 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 Thursday, 31 January 2002 17:16:36 UTC