Skip to content

Commit

Permalink
Detach PyQt6 QPixmap instance before returning
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Oct 28, 2024
1 parent 9a4b3e0 commit 73600ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ jobs:
pytest-cov
pytest-timeout
- name: Install CPython dependencies
if: "!contains(matrix.python-version, 'pypy')"
run: >
python3 -m pip install
PyQt6
- name: Install dependencies
id: install
run: |
Expand Down
5 changes: 4 additions & 1 deletion src/PIL/ImageQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,7 @@ def toqimage(im: Image.Image | str | QByteArray) -> ImageQt:

def toqpixmap(im: Image.Image | str | QByteArray) -> QPixmap:
qimage = toqimage(im)
return getattr(QPixmap, "fromImage")(qimage)
pixmap = getattr(QPixmap, "fromImage")(qimage)
if qt_version == "6":
pixmap.detach()
return pixmap

0 comments on commit 73600ee

Please sign in to comment.