Community Discussions and Support
Pegasus doesn't close file system handles

[quote user="David Harris"][quote user="vefatica"]

There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.

[/quote]

There are two separate and distinct problems here. The first is Windows itself: when you call GetOpenFileName, a side-effect of selecting a file is to change the current working directory to the one containing the selected file. As long as any application has a directory selected as its working directory, no other application can rename or delete that directory. It's probably possible to work around this problem (I've made a note to check it out).

The other problem is more complicated. The Borland runtime libraries (from the ageing compiler used to compile v4.41) create a handle to a directory when I do a directory contents scan, and cannot be told to release that handle. The problem is to do with the legacy "findfirst" and "findnext" routines, which date from DOS times and which don't have a matching "endfind" command to terminate the scan. As a result, the RTL has to do some calisthenics - essentially, it tries to "guess" when the directory handle is no longer required and doesn't release it until then. It's most unsatisfactory, and has other side-effects as well. It's also totally outside my control in that version of the code.

As part of the move to Visual C, I had to rework these routines from scratch, so this problem no longer occurs in the current builds of the program. This means you can expect it to be fixed in the next update.

[/quote]

Thanks for the in-depth reply.  I didn't know GetOpenFileName() did that (it's not very nice).  I've used GOFN() but was never bitten by it.  And I had wondered about the status of the move to VC.

 - Vince 

[quote user="David Harris"][quote user="vefatica"]<p>There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.</p><p>[/quote] There are two separate and distinct problems here. The first is Windows itself: when you call GetOpenFileName, a side-effect of selecting a file is to change the current working directory to the one containing the selected file. As long as any application has a directory selected as its working directory, no other application can rename or delete that directory. It's probably possible to work around this problem (I've made a note to check it out). The other problem is more complicated. The Borland runtime libraries (from the ageing compiler used to compile v4.41) create a handle to a directory when I do a directory contents scan, and cannot be told to release that handle. The problem is to do with the legacy "findfirst" and "findnext" routines, which date from DOS times and which don't have a matching "endfind" command to terminate the scan. As a result, the RTL has to do some calisthenics - essentially, it tries to "guess" when the directory handle is no longer required and doesn't release it until then. It's most unsatisfactory, and has other side-effects as well. It's also totally outside my control in that version of the code. As part of the move to Visual C, I had to rework these routines from scratch, so this problem no longer occurs in the current builds of the program. This means you can expect it to be fixed in the next update. [/quote]</p><p>Thanks for the in-depth reply.  I didn't know GetOpenFileName() did that (it's not very nice).  I've used GOFN() but was never bitten by it.  And I had wondered about the status of the move to VC.</p><p> - Vince </p>

There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.  I suppose that's because the last attachment I sent (8 days ago!) was from that folder.  That simply shouldn't happen.  Pegasus should close handles when it's finished with them so other apps (including and especially the shell) can behave normally.

So I started a new email, added an attachment from another folder and cancelled the email.  That got rid of two of the handles; I still couldn't rename the folder.  So I repeated that experiment, this time sending the email.  Only then did Pegasus close the last two handles to the (week-old) attachment directory.  What a struggle!

Right now Pegasus (running 17 days) has 42 open handles to my mailbox folder, on another machine (Pmail running 10 days), 47.

 - Vince
 

<p>There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.  I suppose that's because the last attachment I sent (8 days ago!) was from that folder.  That simply shouldn't happen.  Pegasus should close handles when it's finished with them so other apps (including and especially the shell) can behave normally.</p><p>So I started a new email, added an attachment from another folder and cancelled the email.  That got rid of two of the handles; I still couldn't rename the folder.  So I repeated that experiment, this time sending the email.  Only then did Pegasus close the last two handles to the (week-old) attachment directory.  What a struggle! Right now Pegasus (running 17 days) has 42 open handles to my mailbox folder, on another machine (Pmail running 10 days), 47.</p><p> - Vince  </p>

There is an application called - Unlocker - that will help. It is freeware and can be downloaded from here:

 

http://ccollomb.free.fr/unlocker/

 

<p>There is an application called - <span style="font-weight: bold;">Unlocker</span> - that will help. It is freeware and can be downloaded from here:</p><p> </p><p><a href="http://ccollomb.free.fr/unlocker/%20" title="Unlocker freeware" mce_href="http://ccollomb.free.fr/unlocker/ ">http://ccollomb.free.fr/unlocker/</a> </p><p> </p>

[quote user="aderoy"]

There is an application called - Unlocker - that will help. It is freeware and can be downloaded from here:

 

http://ccollomb.free.fr/unlocker/

 

[/quote]

I have apps that will do that.  I can also, with a single mouse click, restart Pegasus (which is much easier).  But I shouldn't have to resort to such measures.  The mere act of attaching a file with Pegasus prevents me from renaming or deleting the folder from which that file came.  That's simply wrong, very wrong, and I'm hoping something will be done about it.

 - Vince 

[quote user="aderoy"]<p>There is an application called - <span style="font-weight: bold;">Unlocker</span> - that will help. It is freeware and can be downloaded from here:</p><p> </p><p><a href="http://ccollomb.free.fr/unlocker/%20" title="Unlocker freeware" mce_href="http://ccollomb.free.fr/unlocker/ ">http://ccollomb.free.fr/unlocker/</a> </p><p> </p><p>[/quote]</p><p>I have apps that will do that.  I can also, with a single mouse click, restart Pegasus (which is much easier).  But I shouldn't have to resort to such measures.  The mere act of attaching a file with Pegasus prevents me from renaming or deleting the folder from which that file came.  That's simply wrong, very wrong, and I'm hoping something will be done about it.</p><p> - Vince </p>

Do you use the 4.41 version?

 

<p>Do you use the 4.41 version?</p><p> </p>

-- Han van den Bogaerde - support@vandenbogaerde.net Member of Pegasus Mail Support Group. My own Pegasus Mail related web information: http://www.vandenbogaerde.net/pegasusmail/

[quote user="Han v.d. Bogaerde"]

Do you use the 4.41 version?

 

[/quote]

Yes.

 - Vince

[quote user="Han v.d. Bogaerde"]<p>Do you use the 4.41 version?</p><p> </p><p>[/quote]</p><p>Yes.</p><p> - Vince </p>

[quote user="vefatica"]

There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.

[/quote]

There are two separate and distinct problems here. The first is Windows itself: when you call GetOpenFileName, a side-effect of selecting a file is to change the current working directory to the one containing the selected file. As long as any application has a directory selected as its working directory, no other application can rename or delete that directory. It's probably possible to work around this problem (I've made a note to check it out).

The other problem is more complicated. The Borland runtime libraries (from the ageing compiler used to compile v4.41) create a handle to a directory when I do a directory contents scan, and cannot be told to release that handle. The problem is to do with the legacy "findfirst" and "findnext" routines, which date from DOS times and which don't have a matching "endfind" command to terminate the scan. As a result, the RTL has to do some calisthenics - essentially, it tries to "guess" when the directory handle is no longer required and doesn't release it until then. It's most unsatisfactory, and has other side-effects as well. It's also totally outside my control in that version of the code.

As part of the move to Visual C, I had to rework these routines from scratch, so this problem no longer occurs in the current builds of the program. This means you can expect it to be fixed in the next update.

Cheers!

-- David --

[quote user="vefatica"]<p>There's a folder, "Summer07", on my desktop (files for a course I'm teaching).  I wanted to rename the folder.  Windows XP wouldn't let me because an application was using the folder.  Investigation showed Pegasus Mail had 4 open handles to that folder.</p>[/quote] There are two separate and distinct problems here. The first is Windows itself: when you call GetOpenFileName, a side-effect of selecting a file is to change the current working directory to the one containing the selected file. As long as any application has a directory selected as its working directory, no other application can rename or delete that directory. It's probably possible to work around this problem (I've made a note to check it out). The other problem is more complicated. The Borland runtime libraries (from the ageing compiler used to compile v4.41) create a handle to a directory when I do a directory contents scan, and cannot be told to release that handle. The problem is to do with the legacy "findfirst" and "findnext" routines, which date from DOS times and which don't have a matching "endfind" command to terminate the scan. As a result, the RTL has to do some calisthenics - essentially, it tries to "guess" when the directory handle is no longer required and doesn't release it until then. It's most unsatisfactory, and has other side-effects as well. It's also totally outside my control in that version of the code. As part of the move to Visual C, I had to rework these routines from scratch, so this problem no longer occurs in the current builds of the program. This means you can expect it to be fixed in the next update. Cheers! -- David --
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft