Opened 6 years ago

Closed 6 years ago

#2226 closed defect (can't reproduce)

wrapped C/C++ object of type QOpenGLContext has been deleted

Reported by: Anant.Gharpure@… Owned by: Tom Goddard
Priority: normal Milestone:
Component: Graphics Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Hi,

I keep getting this error message within one minute of opening a session in ChimeraX. I am running version 0.9 through SBGrid. Do you now if there is a quick fix?


An error occurred in drawing the scene. Redrawing graphics is now stopped to avoid a continuous stream of error messages. To restart graphics use the command "graphics restart" after changing the settings that caused the error.

Traceback (most recent call last):
File "/programs/x86_64-linux/chimerax/0.9/lib/python3.7/site-packages/chimerax/core/updateloop.py", line 72, in draw_new_frame
view.draw(check_for_changes = False)
File "/programs/x86_64-linux/chimerax/0.9/lib/python3.7/site-packages/chimerax/core/graphics/view.py", line 137, in draw
if not self._use_opengl():
File "/programs/x86_64-linux/chimerax/0.9/lib/python3.7/site-packages/chimerax/core/graphics/view.py", line 102, in _use_opengl
if not self._render.make_current():
File "/programs/x86_64-linux/chimerax/0.9/lib/python3.7/site-packages/chimerax/core/graphics/opengl.py", line 417, in make_current
return self._opengl_context.make_current()
File "/programs/x86_64-linux/chimerax/0.9/lib/python3.7/site-packages/chimerax/core/graphics/opengl.py", line 134, in make_current
if not qc.makeCurrent(w):
RuntimeError: wrapped C/C++ object of type QOpenGLContext has been deleted


Thanks!

Anant

________________________________

UT Southwestern


Medical Center



The future of medicine, today.


Change History (12)

comment:1 by pett, 6 years ago

Component: UnassignedGraphics
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bugwrapped C/C++ object of type QOpenGLContext has been deleted

comment:2 by Tom Goddard, 6 years ago

This is a strange error saying the OpenGL graphics context has been deleted. Our code should not delete the context until the program is quit.

I see you are using Linux. Is ChimeraX running locally on your computer or is it running on another computer with remote display to your local computer?

You say it gives this error within 1 minute of opening a session. So the session displays correctly, and you can view it for a minute and then spontaneously it gives this error? Is that right? Did you run any command or press a button right before the error?

comment:3 by Tom Goddard, 6 years ago

Are you using ChimeraX stereoscopic display (command "camera stereo")?

in reply to:  4 ; comment:4 by Anant.Gharpure@…, 6 years ago

I was running it locally and not in camera stereo view (I think). It actually worked fine on a different Linux computer we have in the lab, so not sure what the problem is with the first computer.

Thanks!
Anant
________________________________________
From: ChimeraX [ChimeraX-bugs-admin@cgl.ucsf.edu]
Sent: Tuesday, July 16, 2019 6:24 PM
Cc: Anant Gharpure; goddard@cgl.ucsf.edu
Subject: Re: [ChimeraX] #2226: wrapped C/C++ object of type QOpenGLContext has been deleted

#2226: wrapped C/C++ object of type QOpenGLContext has been deleted
---------------------------------------+----------------------
          Reporter:  Anant.Gharpure@…  |      Owner:  goddard
              Type:  defect            |     Status:  assigned
          Priority:  normal            |  Milestone:
         Component:  Graphics          |    Version:
        Resolution:                    |   Keywords:
        Blocked By:                    |   Blocking:
Notify when closed:                    |   Platform:  all
           Project:  ChimeraX          |
---------------------------------------+----------------------

Comment (by goddard):

 Are you using ChimeraX stereoscopic display (command "camera stereo")?

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/2226#comment:3>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

________________________________

UT Southwestern


Medical Center



The future of medicine, today.


comment:5 by Tom Goddard, 6 years ago

Does the computer that gives this problem have more than one display?

comment:6 by Tom Goddard, 6 years ago

Bug #2195 is this same error, also after a session restore, on macOS.

comment:7 by Tom Goddard, 6 years ago

Tests show that this error

RuntimeError: wrapped C/C++ object of type QOpenGLContext has been deleted

is produced if the QOpenGLContext ChimeraX uses has its deleteLater() method called (from say the Python shell). A different error is produced if our Python OpenGLContext wrapper class delete() is called since subsequent renderings after that will recreate a new context, but the OpenGL buffers and other resources from the deleted context were not cleaned up and an OpenGL error results.

So it appears QOpenGLContext is being deleted but not by our code. The QOpenGLContext constructor is called with a parent object, which is the ChimeraX graphics QWindow. If that window is deleted I believe it will delete the QOpenGLContext and all other child objects. ChimeraX does have code that destroys the GraphicsWindow and replaces it, the MainWindow.enable_stereo() method does that. And it keeps the current opengl context for use with the new graphics window. That would explain this error, the MainWindow.enable_stereo() call would cause it. This would happen whenever switching in or out of stereo. The window is replaced only when switching in or out of stereo, not when trying to enable the mode that is already enabled. It appears that enable_stereo() is only called from the camera command. Session restore only handles mono and orthographic camera and appears not to attempt to switch from stereo to mono if stereo was enabled before the restore.

It does not appear that either of the two cases of this bug reported were using stereo camera. Still it seems most likely that the QOpenGLContext is being deleted by Qt because by its parent. Maybe best to not set a parent for the QOpenGLContext if that is allowed.

I've made ChimeraX create QOpenGLContext with no QObject parent to help insure it is not unintentionally deleted. Would rather have a test case that demonstrates this is the problem, but don't have any leads for how to reproduce it.

comment:8 by Tom Goddard, 6 years ago

I made a change that may fix this error -- will be in tonight's ChimeraX builds. If you try it and it fixes the issue let me know.

in reply to:  9 ; comment:9 by Anant.Gharpure@…, 6 years ago

Great, thank you! I will let you know if the issue is fixed, although I may have to wait until the next SBGrid update.
________________________________________
From: ChimeraX [ChimeraX-bugs-admin@cgl.ucsf.edu]
Sent: Tuesday, July 16, 2019 8:09 PM
Cc: Anant Gharpure; goddard@cgl.ucsf.edu
Subject: Re: [ChimeraX] #2226: wrapped C/C++ object of type QOpenGLContext has been deleted

#2226: wrapped C/C++ object of type QOpenGLContext has been deleted
---------------------------------------+----------------------
          Reporter:  Anant.Gharpure@…  |      Owner:  goddard
              Type:  defect            |     Status:  assigned
          Priority:  normal            |  Milestone:
         Component:  Graphics          |    Version:
        Resolution:                    |   Keywords:
        Blocked By:                    |   Blocking:
Notify when closed:                    |   Platform:  all
           Project:  ChimeraX          |
---------------------------------------+----------------------

Comment (by goddard):

 I made a change that may fix this error -- will be in tonight's ChimeraX
 builds.  If you try it and it fixes the issue let me know.

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/2226#comment:8>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker

________________________________

UT Southwestern


Medical Center



The future of medicine, today.


in reply to:  10 ; comment:10 by goddard@…, 6 years ago

You can install the ChimeraX daily build yourself, no need to use the SBGrid version, if you want to use the Linux machine that gives the error.

in reply to:  11 ; comment:11 by goddard@…, 6 years ago

I forgot to check in the fix I made yesterday, so it will be in tonight's ChimeraX builds.

comment:12 by Tom Goddard, 6 years ago

Resolution: can't reproduce
Status: assignedclosed

May be fixed but I am not able reproduce this.

Note: See TracTickets for help on using tickets.