-
Notifications
You must be signed in to change notification settings - Fork 272
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
projectorganizer: Make sure project is open before trying to expand the tree #555
Conversation
…he tree Since expand_on_idle() is called as an idle function, it can happen it's executed after project is closed. Before trying to expand paths it now first checks if the idle call corresponds to the project for which the idle call was created. Should fix crash reported in geany#549.
@techee wouldn't it be better to keep track of the source IDs and connect/disconnect them as a project is opened/closed? Seems more future proof, IMO. |
@techee The crash is gone. But you have to tell if it's the proper fix or not. |
@codebrainz Yeah, it might theoretically happen that one project is closed, another opened afterwards after which the idle function is called still for the first project and expand incorrect paths as a result. I've just submitted a new patch - instead of saving the source IDs which I'd have to store to some global variable, I just pass the Geany project pointer to the idle function and there check if it's still the same project. Should do the same job. |
Plugins can now have associated data, so you could just store the handler ID in there with other plugin-wide state. In any case, I'm sure it's fine, my OCD just doesn't like when code doesn't undo this kind of stuff, which is why I'm such a big fan of C++ RAII :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch solves #549 partially. See below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't realize that with this patch a new crash occur when opening a file with no project opened.
I vererted the merge as on further testing I'm getting
Please double check (no projects active) |
It crash on an Geany without an open document only instant save from saveactions was activated |
Should be fixed in #559. Sorry for not noticing this myself, I just usually have some project open. |
Since expand_on_idle() is called as an idle function, it can happen it's
executed after project is closed in which case it should just return
without accessing variables with invalid values.
Should fix crash reported in #549.