Skip to content

Conversation

@b4n
Copy link
Member

@b4n b4n commented Jul 6, 2025

⚠️ Beware, this is entirely untested, beside compiling OK.

b4n added 4 commits July 5, 2025 22:36
Fix potential crash if `glspi_close()` or `glspi_save()` are given
invalid document filenames.
Fix potential crash passing an invalid document index to
`glcpi_save()`, `glcpi_open()` or `glcpi_close()`.
@b4n b4n added this to the 2.2.0 milestone Jul 6, 2025
@b4n b4n requested a review from xiota July 6, 2025 11:12
@b4n b4n assigned xiota Jul 6, 2025
@xiota
Copy link
Contributor

xiota commented Nov 5, 2025

Looks good to merge. Tested with examples/work/01.edit-test-script.lua and following scripts:

-- script 1
local files={}

for file in geany.documents()
do
  table.insert(files,file)
end

if ( #files > 0 )
then
  file=geany.choose("Choose a tab to activate:", files)
  if (file)
  then
    geany.save(file)
    geany.activate(file)
  end
else
  geany.message("No files!")
end
-- script 2
if geany.save(-5) then
  geany.status('save document -5')
else
  geany.status('save document 2')
  geany.save(2)
end

if geany.activate(-3) then
  geany.status('activate third tab')
else
  geany.status('activate fourth document')
  geany.activate(4)
end

Script 2 outputs following in status window:

00:00:00: save document 2
00:00:00: File ... saved.
00:00:00: activate third tab

@xiota
Copy link
Contributor

xiota commented Nov 5, 2025

Also, confirmed crash when unpatched and fixed when patched:

geany.save('/tmp/does-not-exist.txt')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants