A little buglet

notHeidi's profile image notHeidi posted 4 years ago in General Permalink

If I open a Query tab, and click the "Load SQL file.." button, and the file/data is too large for the tab window, it offers to run the SQL directly... that's fine and it all works.

However, it doesn't seem to release the handle on the file when it's finished. If I try to delete the file in Windows File Manager I get a messagebox telling me that it is "being used by another process" and I have to close Heidi before it will let me do so.

So... nothing major, but...

ansgar's profile image ansgar posted 4 years ago Permalink

The file should definitely be released after HeidiSQL has finished with it.

I could just rename a file after I ran it in HeidiSQL.

Judging from the code, the file gets released:

Stream := TFileStream.Create(Filename, fmOpenRead or fmShareDenyNone);
// code for running SQL code...
Stream.Free;

Could it be the file is locked by some other process? There is this neat Handle program, which you could use to find out.

notHeidi's profile image notHeidi posted 4 years ago Permalink

I thought I had eliminated that possibility - I've had this issue a few times, esp as I don't tend to open these files (that I restore from fairly often) elsehow... But trying agin now it seems fine. Sigh. IDK. Well... I (double) check more carefully next time it happens, with that handle app, and see.... thanks.

ansgar's profile image ansgar posted 4 years ago Permalink

Thanks for re-checking - and for the word buglet 🐞

Please login to leave a reply, or register at first.