View Single Post
Old 07-12-2022, 04:37 AM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I see what is happening. When you open a database it registers its user-defined formatter functions using the library UUID. When a database instance is closed it de-registers them using that UUID. This means that if you open the *same* database twice then the functions are registered using the same UUID, which in practice means they are registered once. When either is closed the functions for both are deregistered because they share the UUID.

You can see this happening in your log:
Code:
backend.close - unloading template functions 32d3fa1c-9a4a-450a-a422-e0dcface23d5
[7.64] main UI initialized...
The problem can be avoided by passing is_second_db=True when opening the database.

I looked at checking for a second registration of functions for a given database. That won't work because it is legal to re-register functions for an open db instance, for example when functions are created/changed in preferences / template functions.
chaley is offline   Reply With Quote