MantisBT - VTK
View Issue Details
0003091VTK(No Category)public2006-04-04 16:242016-08-12 09:54
Helmut Herrmann 
Kitware Robot 
lowmajoralways
closedmoved 
 
 
0003091: Crash in vtkWin32OpenGLRenderWindow::InitializeApplication()
Our application often creates and deletes VTK objects more than once during a session. I had to add
UnregisterClass("vtkOpenGL", this->ApplicationInstance);
UnregisterClass("vtkOutputWindow", this->ApplicationInstance);
in order to avoid a crash in vtkWin32OpenGLRenderWindow::InitializeApplication() when creating objects a second time.
No tags attached.
zip iv_vtk_test3.zip (1,472) 1969-12-31 19:00
https://www.vtk.org/Bug/file/5510/iv_vtk_test3.zip
Issue History
2008-11-30 09:12Mathieu MalaterreAssigned ToMathieu Malaterre => François Bertel
2010-09-07 13:46François BertelAssigned ToFrançois Bertel =>
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036851
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved
2016-08-12 09:54Kitware RobotAssigned To => Kitware Robot

Notes
(0003964)
Mathieu Malaterre   
2006-04-04 18:40   
Can you provide an example to reproduce the problem ? Thanks
(0003966)
Helmut Herrmann   
2006-04-05 04:18   
I tried to provide an example to reproduce the problem. Unfortunately, I cannot reproduce it with a simple and small Windows application. I assume the probem is connected to the architecture of our application and to the use of Qt. I can try to create a Qt based example. However, in this case I would have to send you qt-mt334.dll. Would that be ok for you?
(0003977)
Helmut Herrmann   
2006-04-07 06:27   
As I mentioned in a previous comment, I have not been able to create a simple application that reproduces the problem. Even our application does not always crash. So I decided to describe the problem in more detail without providing a running example.

Our application is based on Qt 3.3.4 and consists of almost 100 DLLs. On demand one of these DLLs loads a Qt and VTK based DLL used for 3D visualization. The application executes scripts. When I leave a script in order to run another script, the visualization DLL is freed. If the next script also requires 3D visualization, it reloads the VTK based module. Thus, it is possible that during a session the VTK module is loaded and freed several times.

The events concerning vtkWin32OpenGLRenderWindow.cxx are as follows:

1st script execution
--------------------
InitializeApplication():
this->ApplicationInstance = 0
this->ParentId = 0x...
Calling this->ApplicationInstance = (HINSTANCE)vtkGetWindowLong(this->ParentId,vtkGWLP_HINSTANCE);
-> this->ApplicationInstance = 0x400000

CreateAWindow():
GetClassInfo(this->ApplicationInstance,"vtkOpenGL",&wndClass) = 0
-> RegisterClass(&wndClass) is called

CreateAWindow(): -> OK


2nd or later script execution
-----------------------------
InitializeApplication():
this->ApplicationInstance = 0
this->ParentId = 0x...
Calling this->ApplicationInstance = (HINSTANCE)vtkGetWindowLong(this->ParentId,vtkGWLP_HINSTANCE);
-> this->ApplicationInstance = 0x400000

CreateAWindow():
GetClassInfo(this->ApplicationInstance,"vtkOpenGL",&wndClass) != 0
-> RegisterClass(&wndClass) is NOT called

CreateAWindow(): -> might CRASH

The difference between first and later script execution is that during the first run GetClassInfo() is 0 and in the later runs it is no longer 0 and RegisterClass() is not called. Thus, I added UnregisterClass() to the destructor of vtkWin32OpenGLRenderWindow and have had no more crashes.
(0036851)
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.