Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when exporting recipe #821

Closed
jimdbr opened this issue Sep 3, 2024 · 13 comments
Closed

Crash when exporting recipe #821

jimdbr opened this issue Sep 3, 2024 · 13 comments

Comments

@jimdbr
Copy link

jimdbr commented Sep 3, 2024

Brewtarget crashes when I try to export a recipe. Both BeerJSON and BeerXML formats are affected. The error is:

[15:56:04.678] (19qj0mxk8w) ERROR : ASSERT: "propertyIndex >= 0" in file /home/jim/Src/brewtarget/src/utils/PropertyPath.cpp, line 149 [utils/PropertyPath.cpp:149]

@matty0ung
Copy link
Contributor

The export seems to work on my machine, so I'm wondering if the bug only happens with some recipes. If you want to send me your database file (either here or by email to matt AT brewtarget.beer) I can have another look. Otherwise, if you're building from source, I can suggest how to get some more diagnostics.

@jimdbr
Copy link
Author

jimdbr commented Sep 4, 2024

My database has been edited, repaired and converted many times so I went back to the default database. It also crashes when I try to export a recipe. I did a complete clean and rebuild. Still crashes. The recipe file has just an XML header.

Log file attached.

brewtarget.log

@matty0ung
Copy link
Contributor

Thanks. I can see what it's doing now. It's trying to export the Style record, which is a sub-record of the Recipe one, but it's still using the Recipe field mappings instead of picking up the Style ones, so it goes round in circles, tries to find the style of a style and barfs. Should be a small fix (I hope). Will have a dig.

@matty0ung
Copy link
Contributor

I have a fix for the first crash. Found a subsequent one. I know what's causing it. Just having a think about the right way to fix it.

@matty0ung
Copy link
Contributor

There were basically three bugs here. The one I described above and two others.

One of the other bugs was about pointer types: a place in the code where we assumed raw pointers were always returned, which used to be true, but which now needs to deal with the possibility of the returned value being a shared pointer.

The other bug was about nested properties. Now that (because of BeerJSON), a fermentation and a boil are separate things from a recipe (ultimately making it easier to share boil profiles and fermentation profiles across recipes), we have to map that across to BeerXML where things such as primary fermentation temperature are direct properties of recipes. We have all the mechanism to do that, but it changes one of the assumptions in the code. In the old days we always had something, even if it was 0 or blank, to write out for secondary fermentation temperature. But now, it's possible there will not be a second stage on the recipe's fermentation, so we can't get any temperature for it. That's OK, we just don't skip the field and don't write it out in those circumstances (instead of asserting).

@matty0ung
Copy link
Contributor

As ever, please shout if you find other bugs. (There may still be a few "QMetaProperty::read: Unable to handle unregistered datatype" errors to crawl out of the woodwork. They are annoying but a one-line fix to remedy.)

@jimdbr
Copy link
Author

jimdbr commented Sep 5, 2024

Fresh pull and build. Same error. Log file attached.

brewtarget.log

@matty0ung
Copy link
Contributor

The log looks like it comes from the "current" code rather than the 822 patch. (You can tell because the assert on line 149 of utils/PropertyPath.cpp is moved to line 156 in the patched version -- see https://github.com/Brewtarget/brewtarget/pull/822/files#diff-bd34b17c7871d26ae63aa3bd67954507344dfb65f1d67d764a9ff0dfa55b19e6.)

I'll merge the patch now, so you should see the fix in the main branch.

@jimdbr
Copy link
Author

jimdbr commented Sep 6, 2024

Of course I didn't notice the patch. Will try again and let you know what happens.

@jimdbr
Copy link
Author

jimdbr commented Sep 6, 2024

I can export again. The XML looks good. Everything in the log file is INFO, except for the two null warnings that don't appear to affect the export.

Thanks.

[13:07:36.481] (1bytoqnj5s) WARNING : QObject::connect(QPushButton, Unknown): invalid nullptr parameter [:0]
[13:07:36.481] (1bytoqnj5s) WARNING : QObject::connect(QPushButton, Unknown): invalid nullptr parameter [:0]

@matty0ung
Copy link
Contributor

Having a look at the warnings. It's a bit of plumbing etc I forgot to do for the new boil and fermentation editors.

@matty0ung
Copy link
Contributor

Warnings should be fixed in #825 (along with a few other things). Still a bit of tidy-up to do, but headed in the right direction.

@matty0ung
Copy link
Contributor

Fix included in 4.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants