Skip to content

Commit

Permalink
Store weakref to window in Context
Browse files Browse the repository at this point in the history
  • Loading branch information
einarf committed Apr 12, 2020
1 parent f8d09ea commit 1ce0be8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arcade/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ class Context:
}

def __init__(self, window):
self._window = window
self._window_ref = weakref.ref(window)
self.limits = Limits(self)
self._gl_version = (self.limits.MAJOR_VERSION, self.limits.MINOR_VERSION)

Expand Down Expand Up @@ -1481,6 +1481,11 @@ def __init__(self, window):
fragment_shader=self.resource_root / 'shaders/sprite_list_fs.glsl',
)

@property
def window(self):
"""The window this context belongs to"""
return self._window_ref()

@property
def gl_version(self):
""" Return OpenGL version. """
Expand Down

0 comments on commit 1ce0be8

Please sign in to comment.