[vtkusers] Error during cleanup: wglMakeCurrent failed in Clean()
Francois Bertel
francois.bertel at kitware.com
Thu Nov 26 09:17:08 EST 2009
Zamir, have you tried to upgrade your Intel driver as André did?
On Thu, Nov 26, 2009 at 9:08 AM, Zamir Khan <zkhan at modusmed.com> wrote:
> I'm developing on a Windows 7/ VS 2008 platform with an NVIDIA card - the
> error does not occur on this system. The test system that reproduces the
> error is running Windows Vista and has Intel integrated graphics.
>
> Francois Bertel wrote:
>>
>> error 6 is ERROR_INVALID_HANDLE
>>
>> ref: http://help.netop.com/support/errorcodes/win32_error_codes.htm
>>
>> the line vtkWin32OpenGLRenderWindow::Clean() that triggers this error code
>> is:
>>
>> wglMakeCurrent(NULL, NULL);
>>
>> According to the spec, NULL is a valid handle. Maybe it is a bug on MFC
>> side?
>> Which Windows version/Visual Studio do you have?
>>
>>
>> On Wed, Nov 25, 2009 at 4:41 PM, Zamir Khan <zkhan at modusmed.com>
>> <mailto:zkhan at modusmed.com%3E> wrote:
>> > I believe I've fixed the activation context exception (thanks for the
>> > help
>> > there!), but the initial problem still remains - changing the order of
>> > the
>> > cleanup did not help, any other thoughts?
>> >
>> > Is there a good example of the specific order that VTK object cleanup
>> > should
>> > occur in and any specialized calls to be aware of (i.e. Finalize,
>> > RemoveAllViewProps, etc)?
>> >
>> > Francois Bertel wrote:
>> >>
>> >> Googling the error message you just gave, shows it has to do with MFC
>> >> and maybe related to call to
>> >> ActivateActCtx(); / DeactivateActCtx(); in some wrong order.
>> >>
>> >> On Wed, Nov 25, 2009 at 11:51 AM, Zamir Khan <zkhan at modusmed.com>
>> >> <mailto:zkhan at modusmed.com%3E>
>> >> <mailto:zkhan at modusmed.com%3E> <mailto:zkhan at modusmed.com%3E%3E> wrote:
>> >> > Thanks Francois - I have tried this before (it *does* seem the
>> >> > logical
>> >> > thing
>> >> > to do), but the initial problem remains and I also then see an
>> >> > additional
>> >> > exception occur on all platforms:
>> >> >
>> >> > "Unhandled exception at 0x77644401 in XXXX.exe: 0xC015000F: The
>> >> > activation
>> >> > context being deactivated is not the most recently activated one."
>> >> >
>> >> > It could be that this is a step in the right direction, but more
>> >> > changes
>> >> > are
>> >> > needed - I'm not sure!
>> >> >
>> >> > Francois Bertel wrote:
>> >> >>
>> >> >> Hello,
>> >> >>
>> >> >> Swap your two parts: delete the renderer first and then the
>> >> >> renderwindow.
>> >> >>
>> >> >>
>> >> >> The reason is that RemoveAllViewProps() (implemented in
>> >> >> vtkViewport.cxx, superclass of vtkRenderer) calls
>> >> >> ReleaseGraphicsResources() on each prop which requires (indirectly)
>> >> >> a
>> >> >> valid window. For example, a prop like vtkActor will call
>> >> >> ReleaseGraphicsResources() on its texture to release the OpenGL
>> >> >> texture object id.
>> >> >>
>> >> >>
>> >> >> On Wed, Nov 25, 2009 at 11:19 AM, Zamir Khan <zkhan at modusmed.com>
>> >> >> <mailto:zkhan at modusmed.com%3E>
>> >> >> <mailto:zkhan at modusmed.com%3E> <mailto:zkhan at modusmed.com%3E%3E>
>> >> >> <mailto:zkhan at modusmed.com%3E> <mailto:zkhan at modusmed.com%3E%3E>
>> >> >> <mailto:zkhan at modusmed.com%3E%3E> <mailto:zkhan at modusmed.com%3E%3E%3E>
>> >> >> wrote:
>> >> >> > I am seeing the following errors from a VTK 5 / MFC application
>> >> >> > when
>> >> >> > I
>> >> >> > close
>> >> >> > it:
>> >> >> >
>> >> >> > ERROR: In ..\..\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 113
>> >> >> > vtkWin32OpenGLRenderWindow (0685AF70): wglMakeCurrent failed in
>> >> >> > Clean(),
>> >> >> > error: 6
>> >> >> >
>> >> >> > ERROR: In ..\..\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 113
>> >> >> > vtkWin32OpenGLRenderWindow (0698BAE8): wglMakeCurrent failed in
>> >> >> > Clean(),
>> >> >> > error: 6
>> >> >> >
>> >> >> > The error will appear 2 or 3 times in the debug output file,
>> >> >> > depending
>> >> >> > on
>> >> >> > what actions I have taken in the program (I assume for the
>> >> >> > instances
>> >> >> > of
>> >> >> > vtkRenderWindow that are problematic). Also, I can only reproduce
>> >> >> > it
>> >> >> > on
>> >> >> > certain platforms (doesn't happen on machine with NVIDIA, but does
>> >> >> > on
>> >> >> > machine with Intel integrated graphics). I have searched the
>> >> >> > mailing
>> >> >> > list
>> >> >> > and the recommendation appears to be to make sure to Finalize()
>> >> >> > the
>> >> >> > vtkRenderWindow (there are 3 of them being instantiated in this
>> >> >> > application). In the destructor of each of the classes that
>> >> >> > instantiate
>> >> >> > vtkRenderWindows, I have the following code snippets:
>> >> >> >
>> >> >> > if (renWin)
>> >> >> > {
>> >> >> > renWin->Finalize();
>> >> >> > renWin->Delete();
>> >> >> > }
>> >> >> > if (renderer)
>> >> >> > {
>> >> >> > renderer->RemoveAllViewProps();
>> >> >> > renderer->Delete();
>> >> >> > }
>> >> >> >
>> >> >> > However, this does not resolve the issue. Any help is appreciated!
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Zamir
>> >> >> >
>> >> >> > --
>> >> >> > Zamir Khan
>> >> >> > Modus Medical Devices
>> >> >> > e-mail: zkhan at modusmed.com <mailto:zkhan at modusmed.com>
>> >> >> > <mailto:zkhan at modusmed.com> <mailto:zkhan at modusmed.com%3E>
>> >> >> > <mailto:zkhan at modusmed.com> <mailto:zkhan at modusmed.com%3E>
>> >> >> > <mailto:zkhan at modusmed.com%3E> <mailto:zkhan at modusmed.com%3E%3E>
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Powered by www.kitware.com
>> >> >> >
>> >> >> > Visit other Kitware open-source projects at
>> >> >> > http://www.kitware.com/opensource/opensource.html
>> >> >> >
>> >> >> > Please keep messages on-topic and check the VTK FAQ at:
>> >> >> > http://www.vtk.org/Wiki/VTK_FAQ
>> >> >> >
>> >> >> > Follow this link to subscribe/unsubscribe:
>> >> >> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> François Bertel, PhD | Kitware Inc. Suite 204
>> >> >> 1 (518) 371 3971 x113 | 28 Corporate Drive
>> >> >> | Clifton Park NY 12065, USA
>> >> >> _______________________________________________
>> >> >> Powered by www.kitware.com
>> >> >>
>> >> >> Visit other Kitware open-source projects at
>> >> >> http://www.kitware.com/opensource/opensource.html
>> >> >>
>> >> >> Please keep messages on-topic and check the VTK FAQ at:
>> >> >> http://www.vtk.org/Wiki/VTK_FAQ
>> >> >>
>> >> >> Follow this link to subscribe/unsubscribe:
>> >> >> http://www.vtk.org/mailman/listinfo/vtkusers
>> >> >>
>> >> >>
>> >> >> ------------------------------------------------------------------------
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> François Bertel, PhD | Kitware Inc. Suite 204
>> >> 1 (518) 371 3971 x113 | 28 Corporate Drive
>> >> | Clifton Park NY 12065, USA
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Please keep messages on-topic and check the VTK FAQ at:
>> >> http://www.vtk.org/Wiki/VTK_FAQ
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://www.vtk.org/mailman/listinfo/vtkusers
>> >>
>> >> ------------------------------------------------------------------------
>> >
>> >
>>
>>
>>
>> --
>> François Bertel, PhD | Kitware Inc. Suite 204
>> 1 (518) 371 3971 x113 | 28 Corporate Drive
>> | Clifton Park NY 12065, USA
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>> ------------------------------------------------------------------------
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtkusers
mailing list