diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ca1737a..8760a65 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,12 @@ Added JPG. In the newly created settings dialog, this behaviour can be changed to always use PNG (the former behaviour) always JPG. +Fixed +----- + +* Fixed a bug where the binary data of deleted images would still hang + around in the bee file. + 0.3.0 - 2023-11-23 ================== diff --git a/beeref/fileio/sql.py b/beeref/fileio/sql.py index 7768370..c085c75 100644 --- a/beeref/fileio/sql.py +++ b/beeref/fileio/sql.py @@ -261,6 +261,7 @@ class SQLiteIO: def delete_items(self, to_delete): self.exmany('DELETE FROM items WHERE id=?', to_delete) + self.exmany('DELETE FROM sqlar WHERE item_id=?', to_delete) self.connection.commit() def insert_item(self, item): diff --git a/tests/fileio/test_sql.py b/tests/fileio/test_sql.py index 16656c9..9d43e1b 100644 --- a/tests/fileio/test_sql.py +++ b/tests/fileio/test_sql.py @@ -388,8 +388,12 @@ def test_sqliteio_write_removes_nonexisting_pixmap_item(tmpfile, view): view.scene.addItem(item) io = SQLiteIO(tmpfile, view.scene, create_new=True) io.write() + assert io.fetchone('SELECT COUNT(*) from items') == (1,) + assert io.fetchone('SELECT COUNT(*) from sqlar') == (1,) view.scene.removeItem(item) + + io = SQLiteIO(tmpfile, view.scene, create_new=False) io.create_new = False io.write()