-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
issue-2282: Client changes - [Bug] Crash when hovering on a static array #2284
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
base: master
Are you sure you want to change the base?
Conversation
I tested the msi installer and it does seem to fix the problem. I ran the test case that created the crash and now I can both open the nodes and hover over the array without crashes or issues |
Ok. I have updated both PRs. I rolled back a lot of the code I was working on as it was getting too error prone. I have added a utility to pattern_language to make the two stage creation easier and to allows gradual/on-demand adoption: I have not patched any of the patterns to use two stage creation yet. Another issue is I suspect we’ll get Builds fine for me. The client side GitHub tests fail however. Not sure why. Perphaps it's building without the matching pattern_language changes? |
OK. Seems good for me so far. I've added enough two-stage constructions to fix all the bugs I've encountered. I’m sure there’s more. I've also made the parent pointer weak. A framework is (hopefully) in place to easily fix issues as they arise. |
I wanted to test your changes but your builds are failing. The build includes both the ImHex and pattern language changes and the first error can be traced bask to this line in your Imhex repository. std::shared_ptr<construct_shared_object<pl::ptrn::Pattern> Evaluator>Variable(const std::string &name, const ast::ASTNodeTypeDecl *type, const std::optional<Token::Literal> &value, bool outVariable, bool reference, bool templateVariable, bool constant) { I am not sure where that comes from but if you follow the links in your Imhex repository for the pattern language linked there that what you'll find in line 355. I don't see any commits that have that change so you must be linking some other commit as a submodule. |
@paxcut |
Failed again. Had another crack. Tests running. They are not failng so quickly. Looks like you were spot on. Thanks for pointing out the root cause. With my git knowledge I would not have figured that out. |
Ok. Only two tests failed, and they don't look like they are caused by my changes. |
Ok. This PR (and its pattern-side brethren) is now close to where I want it to be for now. The two-stage construction may be contentious, and I get that, but it was used in four pattens to fix (hopefully) real bugs.
Firstly, it is a debugging tool. It has made it easier for me to update It allowed me to find I think perhaps we need think about using the factory patten for But, that said, I’ve not has any crashes with importing patterns and associated activity with these changes. I'm sure someone will rectity that. |
This is an attempt at a fix for issue 2282: [Bug] Crash when hovering on a static array
There are changes to both ImHex and PatternLanguage.
PatternLanguages changes here
Initial debugging suggested a use after free in the parent chain of patterns (0xbaadf00d).
I replaced
Pattern
’s parent pointer with ashared_ptr
. I had to perform CPR (Compile-Patch-Repeat. I just made that up. I dare you to look at me with a straight face and tell me it’s not funny) numerous times. I was slowed down by the time it takes to compile ImHex with even modest changes. I think there is way too much implementation in header files. But I digress.Along the way I fixed other issued as I encountered them. Of note:
new
ed but notshared_ptr
edI think that it was basically a memory management issue.
All that said, I don’t know the code well, and I made heaps of changes. It’s possible I’ve fixed something and broken other stuff. My money is on something being broken by this.
There are some failed checks.
Oh yeah, there's a
const_cast
. I'll look into getting rid of that. The compiler was fighting back and I was getting over it.