Bug 43883

Summary: LibO started via Windows Explorer does not release lock on directory when file is closed (win only)
Product: LibreOffice Reporter: Ed <edmund_eyles>
Component: LibreofficeAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact: Agnieszka <agnieszka.wnukiewicz>
Severity: normal    
Priority: medium CC: amartin, lionel
Version: 3.4.4 release   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description Ed 2011-12-16 05:24:35 UTC
This is on Windows XP.  

This happens when you start LibreOffice from Windows Explorer by using Windows' file type associations: you double-click on a LibreOffice file in Windows Explorer and it opens that file in LibreOffice.  If you then close the file in LibreOffice (but leave the application running), the lock on the file is correctly released, and it can then be deleted, for example.  However, LibreOffice retains a lock on the directory from which the file was opened, and, even with the file closed, you cannot delete the directory while LibreOffice is still running.  

To reproduce:
- create a new directory anywhere
- copy any LibreOffice file to this directory
- with LibreOffice not already running, double-click (or press Enter) on this file
- observe the file correctly opens in LibreOffice
- close the file in LibreOffice, but leave LibreOffice running
- in Windows Explorer, attempt to delete the file you have just opened and closed
- observe this happens correctly
- now attempt to delete the directory you created
- observe that this throws an error ("Cannot delete <dirname>: It is being used by another person or program" on Windows XP)

I would suggest that when LibreOffice is started this way, it should not place a lock on the directory from which it is started.  Alternatively, if it must place such a lock, it should release it when the file is closed.  

This problem does not occur if you start LibreOffice from the Start Menu, then open a file either using the LibreOffice menu or via Windows Explorer.
Comment 1 Agnieszka 2012-01-03 13:33:34 UTC
When you start LibreOffice from Windows Explorer by using Windows XP and you have just opened and closed a LibreOffice file. If you then close the file in
LibreOffice, but leave the application running, you can not delete the directory. You see the error: "Cannot delete <dirname>: It is being used
by another person or program".
Comment 2 ign_christian 2013-06-21 05:48:18 UTC
Still reproducible on LO 4.0.4.2 & Win7 Home Premium 32bit, not only on XP.

Directory/folder still locked by LO though it's empty.
Comment 3 Andrew Martin 2014-03-25 13:53:38 UTC
I've experienced a very similar problem accessing files on a Samba share (Samba 3.6.3) on Windows 7 Professional amd64 and using LibreOffice 4.0.5.2. After a reboot if I navigate to the share and open the file, it opens correctly the first time. I then close it, and no lock file remains. Also, running smbstatus on the server does not show the LibreOffice file as being open. However, when I double-click on it again in explorer, I get the warning that it is locked by unknown user. If I instead open LibreOffice and go to File - Open, it opens successfully without the error.
Comment 4 Lionel Elie Mamane 2014-04-07 15:15:38 UTC
FWIW, the Windows Notepad has the same behaviour.

My guess is that this is the "currently active directory" which is never changed after startup. On GNU/Linux (and other Unix clones) it does not matter that much because a used directory can be unlinked (becomes unreachable (invisible) from the filesystem and will automatically be effectively deleted when closed by the last program having it open). With Windows' approach of "refuse to delete something in use", well, this becomes visible.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.