moses-palmer / pystray

GNU General Public License v3.0
472 stars 59 forks source link

Stop before run or run_detached crash #125

Closed Astru43 closed 1 year ago

Astru43 commented 2 years ago

Calling icon.stop() before caling icon.run() or icon.run_detached() throws an exception.

Traceback (most recent call last):
  File "D:\Codes\Python\matrix\src\main.py", line 114, in <module>
    icon.stop()
  File "D:\Codes\Python\matrix\.venv\lib\site-packages\pystray\_base.py", line 248, in stop
    if self._setup_thread.ident != threading.current_thread().ident:
AttributeError: 'Icon' object has no attribute '_setup_thread'
moses-palmer commented 1 year ago

Thank you for your report.

I have corrected this, and the fix is merged into the main branch and will be part of the next release.