[vtk-developers] Patch for vtkCocoaRenderWindowInteractor TerminateApp behavior

Pat Marion pat.marion at kitware.com
Fri Aug 3 11:36:00 EDT 2012


Hi,

The PCL community uses VTK as their visualization engine.  They are
interested in using VTK render windows that can enter, leave, and restart
interaction loops.  They've encountered an inconsistent behavior OSX, and I
tracked it down to an issue in vtkCocoaRenderWindowInteractor.

Attached is a test program that makes repeated calls to interactor Start()
and TerminateApp().  The test creates a render window and calls interactor
Start().  You can press 'Q' to trigger TerminateApp(), causing the
interactor to return from Start() and begin a new loop. The test exhibits
different behavior on Linux vs. OSX.  On Linux, it successfully restarts
the interaction loop, but on OSX the render window is destroyed after the
first loop.  I'm told the behavior on Windows is consistent with Linux, but
I did not test there.

I attached a patch for vtkCocoaRenderWindowInteractor.  In this patch,
TerminateApp() will break the NSApplication run loop, but not destroy the
NSWindow.  I think this makes OSX behave similarly to the Xt implementation
on Linux.  Can someone who is familiar with vtkCocoaRenderWindowInteractor
take a look at the patch?  Thanks!

Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120803/810c2a7d/attachment.html>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8)
project(TestTerminateApp)

find_package(VTK REQUIRED)
include(${VTK_USE_FILE})

add_executable(TestTerminateApp MACOSX_BUNDLE TestTerminateApp.cxx)
target_link_libraries(TestTerminateApp vtkRendering)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestTerminateApp.cxx
Type: application/octet-stream
Size: 1205 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120803/810c2a7d/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkCocoaRenderWindowInteractor-TerminateApp-fix.patch
Type: application/octet-stream
Size: 4121 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120803/810c2a7d/attachment-0003.obj>


More information about the vtk-developers mailing list