Skip to content

Commit 09d948c

Browse files
committed
Explode in a less horrific manner on window create fail
This is core-dumping on Linux in the absence of OpenGL.
1 parent 745c0a5 commit 09d948c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/flitter/render/window/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,10 @@ def create(self, engine, node, resized, *, opengl_es=False, **kwargs):
507507
glfw.window_hint(glfw.CENTER_CURSOR, glfw.FALSE)
508508
glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE)
509509
self.window = glfw.create_window(self.width, self.height, title, None, Window.Windows[0].window if Window.Windows else None)
510+
errno, msg = glfw.get_error()
511+
if errno:
512+
self.window = None
513+
raise RuntimeError(f"Unable to create window: {msg.decode('utf8')}")
510514
glfw.set_key_callback(self.window, self.key_callback)
511515
glfw.set_cursor_pos_callback(self.window, self.pointer_movement_callback)
512516
glfw.set_mouse_button_callback(self.window, self.pointer_button_callback)

0 commit comments

Comments
 (0)