Skip to content

Commit

Permalink
Fixed issue where the ImageRenderer's GL context wasn't released (#616)
Browse files Browse the repository at this point in the history
This caused an issue when running the test suite, which could involve creating multiple hundreds of context, ultimately leading to a crash (see moderngl/moderngl#575)

Also excluded poetry 1.4.1 from CI, see python-poetry/poetry#7686 and pradyunsg/furo#639
  • Loading branch information
abey79 authored Mar 21, 2023
1 parent 7106a71 commit dcd52bd
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 118 deletions.
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

0 comments on commit dcd52bd

Please sign in to comment.