For details, check the individual commit messages.
I suspect this is a result of https://github.com/geany/geany/pull/3891 and some different timings of when the affected functions get called. I haven't investigated the exact reasons, the extra added checks are probably just fine. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3921
-- Commit Summary --
* Fix runtime warning when opening Geany without open files * Fix runtime warning when closing project to a session without open files
-- File Changes --
M src/document.c (6)
-- Patch Links --
https://github.com/geany/geany/pull/3921.patch https://github.com/geany/geany/pull/3921.diff
I'm a tad worried about the second commit where the `document_array` doesn't seem to match the notebook content… I'll try and have a quick look whenever I can to see if the deeper cause isn't too problematic (unless you beat me to it :wink: :wink: )
I'm a tad worried about the second commit where the document_array doesn't seem to match the notebook content… I'll try and have a quick look whenever I can to see if the deeper cause isn't too problematic (unless you beat me to it 😉 😉 )
Just a preliminary analysis.
First, the stack trace I posted is incorrect, it should be: ``` #5 0x0000fffff7c241d0 in document_get_from_notebook_child (page=<optimized out>) at document.c:335 #6 0x0000fffff7c242a4 in document_get_from_page (page_num=<optimized out>) at document.c:361 #7 0x0000fffff7c4b248 in configuration_open_files (session_files=<optimized out>) at keyfile.c:1390 #8 0x0000fffff7c4b354 in configuration_open_default_session () at keyfile.c:1404 #9 0x0000fffff7c5e430 in destroy_project (open_default=1) at project.c:480 #10 0x0000fffff7c5e4d8 in project_close (open_default=1) at project.c:435 ```
Second, I bisected it to https://github.com/geany/geany/commit/23367de0c5237558ea63cb8c711d46390d9782... so it's an earlier problem.
That's about all for today ;-).
Couldn't resist ;-)
The check here
https://github.com/geany/geany/blob/9bf5769f582cbf3d82a1faca035e7f63e8908afe...
isn't right, is it? `documents_array->len` isn't the number of currently open documents - all of them could be invalid (which happens after closing a session). It should either check the number of open tabs in the notebook or do `foreach_document(i) { count++; }` to get the right number.
@techee pushed 1 commit.
8056d620bc067d153197ae5b4b5fae00163c711a Fix open document check in document_get_from_page()
@b4n approved this pull request.
LGTM and the warnings I saw are indeed gone :+1:
Merged #3921 into master.
github-comments@lists.geany.org