Brewtarget / brewtarget

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

Right-click on top level Recipes in treeview Segfaults with null pointer #609

Closed mattiasmaahl closed 3 years ago

mattiasmaahl commented 3 years ago

So, I was looking into issue #10 and found that when you right click on the top-level, image 1, item in Treeview, namly 'Recipes', Brewtarget crashes with a Segfault, image 2. My theory is that due to the fact that this is not a recipe the below image 3. I'm not all read up on @mikfire code regarding the recipe versioning and locking, but a null-check might be in order. Maybe a Check if it was the top-most item clicked?

Image 1

bild

Image 2

bild

Image 3

bild

mattiasmaahl commented 3 years ago

I may have a fix for this coming soon.

Ugly it may be, but fix the issue it will. 😉

matty0ung commented 3 years ago

The null check you suggested seems to work for me when I added it to my local copy of the code. But I didn't dive into the root cause, so maybe @mikfire has something more elegant.

mattiasmaahl commented 3 years ago

Yes, null-check works, but it will present a menu that will do a bunch of stuff that you can't do on that item. I'm figuring out how to alter the menu to only enable the things available. should have a fix up in a PR today.

matty0ung commented 3 years ago

Ah, OK, cool.