zhiyiYo / PyQt-Fluent-Widgets

A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
https://qfluentwidgets.com
GNU General Public License v3.0
5.8k stars 562 forks source link

[Bug]: Internal C++ object (ComboBoxMenu) already deleted #1015

Open ok-oldking opened 5 days ago

ok-oldking commented 5 days ago

What happened?

Internal C++ object (ComboBoxMenu) already deleted 报错, 会导致子窗口退出

Operation System

Windows 23H2

Python Version

3.12

PyQt/PySide Version

PySide6 6.8.0.2

PyQt/PySide-Fluent-Widgets Version

pySide6-Fluent-Widgets-1.7.1

How to Reproduce?

对着ComboBox狂点, 大概点个几次到十几次就会复现. 有时候点第一次就会出现 如果换回用Qt的ComboBox则不会出现

我控件是是放在一个FramelessWindow里面的, 是在弹出的一个子窗口. 可能跟这个有关系 父窗口的使用的MSFluentWindow则不会有问题

Minimum code

        self.skill_combo_box = ComboBox()
        self.skill_options = ["a","b","c"]

        self.skill_combo_box.addItems(self.skill_options)
        self.skill_combo_box.currentIndexChanged.connect(self.on_index_changed)
Error calling Python override of QPushButton::mouseReleaseEvent(): 2024-11-24 20:01:02,949 ERROR MainThread Uncaught exception: Traceback (most recent call last):
  File "D:\projects\sanmou\.venv\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 407, in mouseReleaseEvent
    self._toggleComboMenu()
  File "D:\projects\sanmou\.venv\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 346, in _toggleComboMenu
    self._showComboMenu()
  File "D:\projects\sanmou\.venv\Lib\site-packages\qfluentwidgets\components\widgets\combo_box.py", line 309, in _showComboMenu
    menu.addAction(QAction(item.icon, item.text))
  File "D:\projects\sanmou\.venv\Lib\site-packages\qfluentwidgets\components\widgets\menu.py", line 375, in addAction
    item = self._createActionItem(action)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\projects\sanmou\.venv\Lib\site-packages\qfluentwidgets\components\widgets\menu.py", line 414, in _createActionItem
    super().addAction(action)
RuntimeError: Internal C++ object (ComboBoxMenu) already deleted.