Bug 156850 - PyQT6 (PySide6) Crashes in Python Macro
Summary: PyQT6 (PySide6) Crashes in Python Macro
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.5.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-21 18:57 UTC by tomekluke
Modified: 2023-10-12 03:17 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Hello World GUI test (25.04 KB, text/x-python)
2023-10-11 18:40 UTC, tomekluke
Details
Error Screenshot (19.39 KB, image/png)
2023-10-11 18:41 UTC, tomekluke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tomekluke 2023-08-21 18:57:23 UTC
Description:
Create a Python macro. Add any simple PySide6 (PyQT6) dialog window. Everything works but when the macro ends, whole LO crashes. It does not matter what you use, nothing or combination of sys.exit(app.exec()), app.quit() or other commands. I am not the only one. I found this: https://stackoverflow.com/questions/75325084/is-there-a-possibility-to-close-a-pyqt-dialog-in-libre-office-properly-python-m. In older version of LO, it worked with just sys.exit(app.exec()). After upgrade, the crashes started. Not sure what the older version was. Also it seemed to me that the older LO version has PyQT singleton instance running but in this new version 7.5.5.2, I have to create a new instance in the macro.

Steps to Reproduce:
1. Write a basic HelloWorld Python macro.
2. Add a basic HelloWorld PySide6 dialog using a ui file.
3. Run the macro. It crashes on the last line.

Actual Results:
Crash of LO.

Expected Results:
Gracefully closing the Python macro and continue work in LO.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Other user having the same or very similar problem:
https://stackoverflow.com/questions/75325084/is-there-a-possibility-to-close-a-pyqt-dialog-in-libre-office-properly-python-m

Version: 7.5.5.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-GB (cs_CZ.UTF-8); UI: cs-CZ
Ubuntu package version: 4:7.5.5~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded
Comment 1 Rafael Lima 2023-08-21 20:25:03 UTC
Can you please share a sample script for testing?

How did you instal pyqt6? Are you using the system interpreter or LO's internal interpreter?

What OS are you using?
Comment 2 tomekluke 2023-10-11 18:40:04 UTC
Created attachment 190158 [details]
Hello World GUI test
Comment 3 tomekluke 2023-10-11 18:41:10 UTC
Created attachment 190159 [details]
Error Screenshot
Comment 4 tomekluke 2023-10-11 18:48:55 UTC
(In reply to Rafael Lima from comment #1)
> Can you please share a sample script for testing?
> 
> How did you instal pyqt6? Are you using the system interpreter or LO's
> internal interpreter?
> 
> What OS are you using?

Hi, thank you! Yes, I am attaching a sample script. Runs nicely, when the window is closed, the whole LibreOffice crashes (I am attaching the error screenshot).

I am on Linux Mint 21.2 and LibreOffice is installed using deb. That means LibreOffice is using the system Python interpreter (which I also confirmed in APSO Python Shell).

PyQT6 was installed using 'pip install PyQt6' or actually 'pip install PySide6' maybe (not sure now) into the system Python.

My friend was also successful on Mac with installing PyQT6 using pip into LibreOffice's Python interpreter and the window also runs nicely. Not sure if it also crashes on close but he has an older version of LO anyways and in that older version (not sure which) closing the window did not crash LO both on Mac and Linux.

Now I have LibreOffice 7.6.1.2 and closing the PyQT window crashes whole LO.
Comment 5 QA Administrators 2023-10-12 03:17:28 UTC Comment hidden (obsolete)