Re: [Fresco-devel] kit destruction not informing the server?
Nathaniel Smith <[email protected]>
| Newsgroups | gmane.comp.video.fresco.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Sep 13, 2002 at 09:34:33PM -0400, Nick Lewycky wrote: > I'm tracking down the problem where clicking the Print button twice > causes the server to crash. The problem is that the server context > thinks it has a pointer to a valid postscript drawing kit when it doesn't. > > KitImpl::decrement calls ~KitImpl when it detects that its own usage > count is zero. Unfortunately, nobody ever bothers to tell the server > context about that, so it never removes it from > ServerContextImpl::_kits. The only time it ever removes an entry from > _kits is in its own destructor, which means that the server is being > shut down. Ah, interesting. > I've heard that this lifecycle stuff can be complicated so I'm asking > what the correct fix is. I see two options: > > a) make the ServerContextImpl test that the kit is still valid before > trying to make calls on it. (Not certain myself how to do that.) > > b) make the KitImpl hold on to a ServerContext_var and add a function to > the API that allows the Kit to inform the server context that the kit is > now gone > > Or is there supposed to be another mechanism that I simply failed to > notice? I have a hard time believing that kit destruction never worked. I'm not an expert on this, so Stefan can thwack me if I spread incorrect information, but: I wouldn't be too surprised if kit destruction never worked -- normally, the kits should only be destructed when a client exits, at which point it's unlikely that that client's kits will be used again. So there could well be no crash. Why don't you just have the ClientContext hold a reference to the kits? (In general, I suppose we can't count on a malicious/buggy client double-dereferencing, though...) -- Nathaniel -- "But in Middle-earth, the distinct accusative case disappeared from the speech of the Noldor (such things happen when you are busy fighting Orcs, Balrogs, and Dragons)." This email may be read aloud.