MantisBT - VTK
View Issue Details
0001125VTK(No Category)public2004-09-01 18:272016-08-12 09:54
pra 
Will Schroeder 
normalmajoralways
closedmoved 
 
 
0001125: Strange interaction between tk_getOpenFile and vtkTkRenderWidget
Dear,

I have a strange behavior in a TCL script (see below). If the line "reader SetFileName $file_in" is included at start the TkRenderWidget reports the following error when the program is terminated:

A TkRenderWidget is being destroyed before it associated vtkRenderWindow is destroyed. This is very bad and usually due to the order in which objects are being destroyed. Always destroy the vtkRenderWindow before destroying the user interface components.

But try to play with the two lines right below vtkPolyDataReader and you'll see different (but deterministic) behaviors depending on which lines are included (You get different different mouse interaction, wireframe on/off works/doesn’t work)

Hope you'll be able to track the bug down.

I'm running on a Dell inspiron 9100 with XP SP1, VTK 4.4 & TCL/Tk 8.3.2 (info patchlevel).

Best wishes,
Per R. Andresen

------------------
package require vtk
package require vtkinteraction

#######################################
#
# Global variables
#
#######################################
set X_SIZE 800; # Size of window
set Y_SIZE 500

set maintitle "crop by Claus"; # title is dynamically changed

# Get input file name
set typelist_in {
    {{Visualization Toolkit (polygonal)} {.vtk} }
    {{All Files } * }
}
set file_in [tk_getOpenFile -filetypes $typelist_in];

# Read file
vtkPolyDataReader reader
   #reader SetFileName $file_in; # DOESN'T WORK if included but it works if the line is pasted from the vtk interactor (press 'u' - pres reset 'r' after loading the file)
   reader SetFileName ""; # mouse interaction changes if or not this line is included when using the vtk interactor as described in the previous line?!?!?

vtkPolyDataMapper clipInMapper
    clipInMapper SetInput [reader GetOutput]

vtkActor actorIn
    actorIn SetMapper clipInMapper

#
# Create the standard rendering stuff.
#
vtkRenderer ren1

vtkRenderWindow renWin
  renWin AddRenderer ren1

# Add the actors to the renderer, set the background and size
#
ren1 AddActor actorIn

#
# Create the Tk widget, associate it with the renderwindow.
#
set vtkw [vtkTkRenderWidget .ren \
        -width ${X_SIZE} \
        -height ${Y_SIZE} \
        -rw renWin]

#
# Pack the Tk widget.
#
pack $vtkw -side top -fill both -expand yes

#
# Sets event handlers
#
::vtk::bind_tk_render_widget $vtkw
No tags attached.
Issue History
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036748
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved

Notes
(0001432)
Goodwin Lawlor   
2004-09-15 10:30   
I don't know about the strange interaction you are reporting here but this error message is ususally seen when not exiting the tcl app correctly. This should be done by calling:

     proc cb_exit {} {
        vtkCommand DeleteAllObjects
        exit
    }

which is found in VTK\Wrapping\Tcl\vtkinteraction\bindings.tcl .

You should bind this callback to the toplevel window using:

wm protocol . WM_DELETE_WINDOW cb_exit

This is also the callback that should be bound to any "Exit" command you have in a "File" menu.
(0001433)
Goodwin Lawlor   
2004-09-15 10:35   
I'll try that file name with forward slashes:
VTK/Wrapping/Tcl/vtkinteraction/bindings.tcl
(0036748)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.