Brewtarget/brewtarget

Crash on new recipe creation

Closed this issue · 2 comments

End of error log says:

[18:57:31.055] (17pfaxbif4) ERROR : int ObjectStore::impl::insertObjectInDb(QSqlDatabase&, const QObject&, bool) Wrote new Boil  to database (with primary key  32 ) but it already had primary key 31  [database/ObjectStore.cpp:1260]
[18:57:31.055] (17pfaxbif4) ERROR : ASSERT: "false" in file ../src/database/ObjectStore.cpp, line 1263  [database/ObjectStore.cpp:1263]
Abandon (core dumped)

I think this is a separate issue from the data import problem in #828, so making a separate ticket for it. Will probably nonetheless bundle all the fixes together in the same PR.

This was because we were trying to insert the new Recipe's boil object in the database twice. (I recently changed Recipe so it would automatically handle putting the Boil in the database if it wasn't already there, which is useful when we're reading things in from XML/JSON, etc. So just needed to remove the manual place we were doing it in the UI code.)

Fix included in 4.0.5 release.