[vtkusers] tcl and segmentation fault
hhiraki at lab.nig.ac.jp
hhiraki at lab.nig.ac.jp
Sat Jul 27 12:26:58 EDT 2002
On Fri, 26 Jul 2002 15:26:45 -0400, Sebastien BARRE wrote:
> At 7/25/2002 10:58 PM, hhiraki at lab.nig.ac.jp wrote:
>
> >I suffered the problem and found that "vtkTclInterpStruct" is freed before
> >objects (vtkTkImageViewerWidget in my case) are freed. The attached patch
> >is a halfway hack. (Digression: Tcl_StaticPackage is required to fit the
> >package mechanism of Tcl. Please see tkAppInit.c of recent Tcl/Tk.)
>
> Hi
> Can you please elaborate on this one ?
Hi Sebastien,
It's VTK release 4.0 on RedHat7.1. Each object of vtk has a callback to
free its Tcl command from the interpreter. On the other hand
vtkTclInterpStruct in vtkTclUtil.h which is used in the callback also
seems to have a callback function (vtkCommonDeleteAssocData() in
vtkCommonTclInit.cxx) to free itself. The patch made Tk part of Tcl/Tk
is freed before vtkTclInterpStruct. This was not enough to avoid the
coredump but just vtkTkImageViewerWidget might be freed safely with Tk.
On Tcl_StaticPackage, this function is inseparable with Tk_Init in
tkAppInit.c. Otherwise Tk is not recognized as a statically linked
package.
Actually I had intended to attach one more patch on freeing
vtkTkImageViewerWidget to the original mail:
--- Rendering/vtkTkImageViewerWidget.cxx~ Mon Jun 3 18:11:10 2002
+++ Rendering/vtkTkImageViewerWidget.cxx Thu Jun 13 00:18:28 2002
@@ -295,8 +295,6 @@
vtkGenericWarningMacro("A TkImageViewerWidget is being destroyed before it associated vtkImageViewer is destroyed. This is very bad and usually due to the order in which objects are being destroyed. Always destroy the vtkImageViewer before destroying the user interface components.");
return;
}
- // Squash the ImageViewer's WindowID
- self->ImageViewer->SetWindowId ( (void*)NULL );
self->ImageViewer->UnRegister(NULL);
self->ImageViewer = NULL;
free (self->IV);
Squashing WindowId here seems to be a remnant from vtkXImageWindow and
a cause of coredump now. Would you please examine that?
I am sorry to send out the halfbaked patches and to bother you with my
poor explanation. I might remember things incorrectly. If you would have
any more question, please ask me again.
Regards,
HIRAKI Hideaki
More information about the vtkusers
mailing list