Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where the ImageRenderer's GL context wasn't released #616

Merged
merged 4 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/python-lint-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry!=1.4.1
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ build:
python: "3.10"
jobs:
post_install:
- pip install poetry>=1.2.1
- pip install poetry!=1.4.1
- poetry config virtualenvs.create false
- poetry install -E all --with docs
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Release date: UNRELEASED

### Bug fixes

* ...
* Fixed issue with ImageRenderer where the GL context wasn't released, ultimately causing a crash when running the test suite (which could involve many hundreds of context creation) (#616)


## 1.13
Expand Down
216 changes: 108 additions & 108 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ types-pillow = "^9.4.0.17"
optional = true

[tool.poetry.group.docs.dependencies]
furo = "2022.6.21"
furo = ">=2022.12.7"
sphinx = ">=5.0.2"
sphinx-autobuild = ">=2021.3.14"
sphinx-click = ">=4.3.0"
myst_parser = ">=0.18.0"
sphinx-autodoc-typehints= ">=1.18.3"
sphinx-copybutton = ">=0.5.0"


[tool.poetry.extras]
all = ["matplotlib", "glcontext", "moderngl", "Pillow", "PySide6"]

Expand Down
9 changes: 6 additions & 3 deletions vpype_viewer/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ def __init__(self, size: tuple[int, int]):
Args:
size: image size
"""
ctx = moderngl.create_standalone_context()
self._fbo = ctx.simple_framebuffer(size)
self._ctx = moderngl.create_context(standalone=True)
self._fbo = self._ctx.simple_framebuffer(size)
self.engine = Engine()
self.engine.post_init(ctx, *size)
self.engine.post_init(self._ctx, *size)

def __del__(self):
self._ctx.release()

def render(self) -> Image.Image:
"""Render to a :class:`PIL.Image.Image` instance.
Expand Down