simgunz / anki21-addons_minimize-to-tray

Anki add-on that adds an icon to the system tray in order to allow minimizing Anki
https://ankiweb.net/shared/info/85158043
GNU General Public License v3.0
18 stars 3 forks source link

Anki crashes frequently #5

Closed Crownvalen closed 2 years ago

Crownvalen commented 3 years ago

If HIDE_ON_STARTUP is set to True and the user isn't connected to internet an error will pop up when pressing the button OK Anki will crash, this same error occurs if the user closes any Anki tab while it's supposedly minimized to tray

image

simgunz commented 3 years ago

What anki version are you using?

Crownvalen commented 3 years ago

I'm using Version 2.1.35 (84dcaa86)

simgunz commented 2 years ago

I have tried to replicate the issue both on Linux and Windows but the problem does not arise.

Can you start anki with all other extensions disabled? You can used the "Toggle Enabled" button in the Addons window.

How many Anki profiles do you have? Does the profile selection dialog appear when you start Anki?

Crownvalen commented 2 years ago

I have tried starting it with all the other extensions disabled and the problem continues without changes, I only have one profile named User 1 and the dialog doesn't pops up at start. On the other hand, when I open the profile selection dialog Anki main's tab gets minimized to tray and if I close the profile selection dialog the problem arises again.

Crownvalen commented 2 years ago

Just got the first error message with all the other extensions disabled, when selecting to open the User 1 profile the following error message prompted. I don't know if it has any relation with prior problem.

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site. Debug info: Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2 Platform: Windows 10 Flags: frz=True ao=True sv=1 Add-ons, last update check: 2021-09-22 09:15:59

Caught exception: Traceback (most recent call last): File "aqt\main.py", line 286, in onOpenProfile File "aqt\main.py", line 427, in loadProfile File "aqt\gui_hooks.py", line 2033, in call File "anki\hooks.py", line 583, in runHook File "C:\Users\valen\AppData\Roaming\Anki2\addons21\85158043__init.py", line 152, in minimizeToTrayInit mw.systemTray = AnkiSystemTray(mw) File "C:\Users\valen\AppData\Roaming\Anki2\addons21\85158043__init.py", line 30, in init__ self._configureMw() File "C:\Users\valen\AppData\Roaming\Anki2\addons21\85158043\init__.py", line 129, in _configureMw self.mw.form.actionExit.triggered.disconnect(self.mw.close) TypeError: disconnect() failed between 'triggered' and 'close'

simgunz commented 2 years ago

Try the following:

  1. Open the addon folder with Tools > Add ons > View files
  2. Edit 85158043/__init__.py
  3. Comment the following line by placing a # as follows
    # self.mw.form.actionExit.triggered.disconnect(self.mw.close)
Crownvalen commented 2 years ago

By commenting that line the error went away, though it has the effect that 2 Anki icons appear in tray. image

Regarding the original crashing problem, I found out by the console that Anki doesn't actually crashes but instead exits when is not supposed to. The conditions for it to occur seem to be having the main menu window on tray and exiting any other window of Anki that's not on tray (Card browse, no internet connection error, etc.) image

simgunz commented 2 years ago

Regarding the double tray icon, try the following steps with and without the commented line:

  1. Start anki
  2. From the menu File > Exit
  3. (Do not hoover over the anki icon in the try)
  4. Start anki again

I expect the the double anki icon appears in both cases, this is another problem.

I can now replicate the bug. Still I do not understand one last point, how you can have the browse window shown and the main window in the tray? Clicking the X should send all windows to the tray.

Crownvalen commented 2 years ago

It does send all windows to tray, I open the browse window from another application, though in the case of no internet connection there's no external app interference.