View Single Post
Old 01-01-2024, 02:46 PM   #14
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,645
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
User templates are lost after "Save Composite Columns" plugin is executed and Action Chains/Editor Chains are initialized.

After putting the print.tracestack at other place, I've found this:
Spoiler:

File "C:\git\calibre\src\calibre\debug.py", line 231, in main
File "C:\git\calibre\src\calibre\gui_launch.py", line 73, in calibre
File "C:\git\calibre\src\calibre\gui2\main.py", line 552, in main
File "C:\git\calibre\src\calibre\gui2\main.py", line 564, in run_main
File "C:\git\calibre\src\calibre\gui2\main.py", line 402, in run_gui
File "C:\git\calibre\src\calibre\gui2\main.py", line 418, in run_gui_
File "C:\git\calibre\src\calibre\gui2\main.py", line 376, in initialize
File "C:\git\calibre\src\calibre\gui2\main.py", line 355, in initialize_db
File "C:\git\calibre\src\calibre\gui2\main.py", line 312, in initialize_db_stage2
File "C:\git\calibre\src\calibre\gui2\main.py", line 260, in start_gui
File "C:\git\calibre\src\calibre\gui2\ui.py", line 446, in post_initialize_actions
File "C:\git\calibre\src\calibre\db\cache.py", line 2798, in __del__
File "C:\git\calibre\src\calibre\db\cache.py", line 2836, in close
File "C:\git\calibre\src\calibre\db\backend.py", line 1363, in close
File "C:\git\calibre\src\calibre\utils\formatter_functi ons.py", line 2764, in unload_user_template_functions
File "C:\git\calibre\src\calibre\utils\formatter_functi ons.py", line 109, in unregister_functions
File "C:\git\calibre\src\calibre\utils\formatter_functi ons.py", line 102, in _register_functions


At this point, library functions disappear. Checking backend.py, I can see this:
Spoiler:

def close(self, force=False, unload_formatter_functions=True):
if getattr(self, '_conn', None) is not None:
if self.prefs['expire_old_trash_after'] == 0:
self.expire_old_trash(0)
if unload_formatter_functions:
try:
unload_user_template_functions(self.library_id)
except Exception:
pass
self._conn.close(force)
del self._conn
self.is_closed = True


So, no plugin is responsible. I'm thinking this code is not called if there is no plugin, and that's the reason that it works in that case.

Well, knowing this, at least I know where to look for the functions.

Last edited by Terisa de morgan; 01-01-2024 at 03:50 PM.
Terisa de morgan is online now   Reply With Quote