Skip to content

Commit

Permalink
Merge pull request #22 from pedohorse/better-viewer-error-report
Browse files Browse the repository at this point in the history
crash on failed opengl
  • Loading branch information
pedohorse authored Jan 19, 2024
2 parents 2b07dc4 + 6fca299 commit 4af483d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/lifeblood_viewer/nodeeditor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import random
import sys

from math import log2
from dataclasses import dataclass
Expand Down Expand Up @@ -874,11 +875,16 @@ def drawForeground(self, painter: PySide2.QtGui.QPainter, rect: QRectF) -> None:

painter.beginNativePainting()
if not self.__imgui_init:
logger.debug('initializing imgui')
self.__imgui_init = True
imgui.create_context()
self.__imimpl = ProgrammablePipelineRenderer()
imguio = imgui.get_io()
try:
logger.debug('initializing imgui')
self.__imgui_init = True
imgui.create_context()
self.__imimpl = ProgrammablePipelineRenderer()
imguio = imgui.get_io()
except Exception as e:
logger.exception(f'Failed to initialized opengl context for imgui: {e}')
logger.critical('viewer cannot work without opengl context, shutting down')
sys.exit(1)
# note that as of imgui 1.3.0 ini_file_name seem to have a bug of not increasing refcount,
# so there HAS to be some other python variable, like self.__imgui_config_path, to ensure
# that path is not garbage collected
Expand Down

0 comments on commit 4af483d

Please sign in to comment.