[Xotcl] Segmentation fault

Kristoffer Lawson setok at fishpool.com
Fri Sep 24 15:32:42 CEST 2004


On Fri, 24 Sep 2004, Kristoffer Lawson wrote:

> I'm getting a segmentation fault in relation to XOTcl. I believe the 
> situation that causes it is as follows:
>
> * I have an object C which has a child M.
> * M has a fileevent callback.
> * On receiving complete message, M calls a method in C.
> * If that is an empty message, C destroys itself and closes the socket in the 
> destructor (M is still in fileevent callback).

For what it's worth, here's some more information from the debug output:

Client connected.
  *  init: MsgHandler init called
  *  destroy: next
  *  destroy: destroy MsgHandler
  *  destroy: CmdHandler destroy
    *  destroy: close socket
  *  destroy: ClientConn destroy
  *  destroy: destroy MsgHandler
  *  destroy: destroy MsgHandler
  --var-- ::::readData: data: ,
  *  MsgHandler readData: return
Segmentation fault

MsgHandler is the M object I was talking about, and is a child of 
ClientConn and has a fileevent callback. The funny thing here is that 
apparently the MsgHandler destructor gets called three times. Only one 
MsgHandler object is created here (as can be seen: the init is only called 
once). I guess this is something to do with the delayed destruction model, 
or something?

The segmentation fault thus occurs after all the destructors have been 
called and the event handler returns (the readData method of MsgHandler).

Hope this helps.

                               / http://www.fishpool.com/~setok/



More information about the Xotcl mailing list