Files
hyeonsang010716 1f613b276a fix(marginnote4): close the store's SQLite connections
`MarginNoteStore._connect()` handed back a raw connection that every call
site used as `with self._connect() as conn:`. A connection's own context
manager commits or rolls back but never closes, so each call left the
database file open until the garbage collector reached the connection.

On Windows an open file cannot be removed. Deleting a MarginNote KB could
then fail to remove its store (only a warning is logged), and connecting a
library under the same name reopened that store, so devices paired with
the deleted library were accepted again.

Make `_connect()` a context manager that keeps the transaction and closes
the connection, the same shape the session, reading and file-library
stores already use. The call sites are unchanged. A new test checks that
every connection the store opens is closed, so the regression fails on any
platform, not only where the existing KB deletion test does.
2026-09-14 20:33:29 +09:00
..