Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
312 stars 135 forks source link

Editing mash crashes the program #606

Closed Drevi closed 3 years ago

Drevi commented 3 years ago

Modifying anything in the mash tab causes the following crash: image

It doesn't matter if it's amount, time, temp or if you edit by hand or the mash wizard/designer. Tried both with my own recipes on an imported db from 2.3, and on an empty fresh 2.4 db.

The crash log:

[05:41:52.268] INFO : QString Database::findRecipeFromForeignKey(TableSchema, const NamedEntity) couldn't find a key for "", in 1085

matty0ung commented 3 years ago

Ah, hmm, yes, that happens for me too. I'll see if there's a quick fix. (If not, the new database code I'll shortly backport from Brewken to Brewtarget does not have this bug. So, one way or another it will get resolved.)

matty0ung commented 3 years ago

OK, I know what's going on here. There's a bug in Database::modifyEntry() where, in certain circumstances, it is calling the wrong version getParentRecipe(). We need to do some downcasting in one of the functions to take account of the fact that MashStep and BrewNote have their own special versions of getParentRecipe() I'll work on a fix.

matty0ung commented 3 years ago

I've made fix. It's a bit ugly, but it works and, in any case, will get changed when I do the new DB layer. (I'm actually part-way through porting forward @mikfire's recipe versioning code to Brewken as a prelude to being able to backport the new DB layer to Brewtarget. So this is hopefully within the foreseeable future.)

Drevi commented 3 years ago

Thanks, working flawlessly with this fix.