[Gambas-devel] Bug in IDE (0.74)
Daniel Campos
danielcampos at ...45...
Sat Dec 27 23:24:31 CET 2003
Hi:
Carlos Mauro told me about a bug in Gambas IDE (he will write
a report to the list soon to extend the information).
But, by now, I found this:
When trying to write a modified form, the program failed:
[unimauro at ...88... gambas-0.74]$ gambas
FEditor.Save.81: #43: Access forbidden
[unimauro at ...88... gambas-0.74]$ gambas
FForm.Save.245: #43: Access forbidden
This is a problem with file rights (no write permission), but the IDE
crashes instead of telling the problem. I've found that File.Save and
File.Rename are not protected in some methods, so I suggest a path like
this:
(at Feditor.class )
PUBLIC SUB Save()
'Project.Config.WriteString("/Window" &/ Name &/ "Pos",
' CStr(ME.X) & "," & CStr(ME.Y) & "," & CStr(ME.Width) & "," &
CStr(ME.Height))
IF NOT $bModify THEN RETURN
TRY KILL Path & "~"
TRY RENAME Path AS Path & "~" ' Protected
IF Error THEN
Message.Error("Access Forbiden : unable to Rename file" )
RETURN
END IF
TRY File.Save(Path, edtEditor.Text) ' Protected
IF Error THEN
Message.Error("Access Forbiden : unable to Save " & Path)
RETURN
END IF
$bModify = FALSE
DrawTitle
END
In fact, the same error happens in other classes, like FForm :
PUBLIC SUB Save()
DIM hFic AS File
IF NOT $bModify THEN RETURN
ResetSave
AddLine(Project.FORM_MAGIC)
AddLine()
SaveOne(Control[Name])
TRY KILL Path & "~"
RENAME Path AS Path & "~" <- THESE TWO LINES CAN CRASH THE PROGRAM!
File.Save(Path, $sSave)
'OPEN Path & ".test" FOR CREATE AS #hFic ' y a un truc bizarre avec
CREATE !
'PRINT #hFic, $sSave
'CLOSE #hFic
$sSave = ""
$bModify = FALSE
DrawTitle
END
The program also fails when you try to exit and it asks to you "The
project has been modified : Save?, Forget?" (free translation:),
so may be these "Save" methods should be Functions returning OK
or Error, instead of "Subs" so the program can cancel the exiting, and
let the user save the program in another folder; think that may be
somebody can be working on a hard disk or network device that has been
umounted by other user, so our programmer would lost all his changes!
Regards,
Daniel Campos
--
Daniel Campos <danielcampos at ...45...>
More information about the Devel
mailing list