Closed Bug 374315 Opened 17 years ago Closed 2 years ago

lockProfileDirectory is not release

Categories

(Core Graveyard :: Java to XPCOM Bridge, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: gerald_leder, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Build Identifier: 

I'm using the code from https://bugzilla.mozilla.org/show_bug.cgi?id=340960#c16 to have a create a create a lock with "mozilla.lockProfileDirectory(profileDir);"
But the problem is that when I shutdown the file "parent.lock" has still a lock on it. On shutting down I use the code from
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.atf/components/plugins/org.eclipse.atf.mozilla.ide.core/src/org/eclipse/atf/mozilla/ide/core/MozillaHelper.java?revision=1.5&root=WebTools_Project&view=markup
I create the shutdown hock where I call
{
Mozilla.getInstance().termEmbedding();
deleteDir(profileDir);
}

The documentation of the method at
http://mxr-test.landfill.bugzilla.org/mozilla1.8.x/source/extensions/java/xpcom/interfaces/IGRE.java#80
says "The directory will remain locked until the lock is released by invoking the <code>release</code> method." My problem is that there is no "release()" method and I call already termEmbedding(). 

So how can I get ride of this lock? Because as long as this lock exists I cannot delete the whole profile directory. The parent.lock automatically disapears after the jvm shutdown but then I cannot clean up the rest.


I use:
  Mozilla mozilla = Mozilla.getInstance();
...
  try {
     File grePath = Mozilla.getGREPathWithProperties(range, null);
     mozilla.initialize(grePath);
     profLock = mozilla.lockProfileDirectory(profileDir);
     LocationProvider locProvider = new LocationProvider(grePath, profileDir);
     mozilla.initEmbedding(grePath, grePath, locProvider);
     mozilla.notifyProfile();
  } catch (XPCOMInitializationException xie) {
     // handle exception
  } catch (XPCOMException xe) {
     // handle exception
  }

Reproducible: Always
Pervisouly I did not call release but I tried it now with the same result.
I tried to call release() (before and after termEmbedding). But I'm still not able to delete the file. 

if (profLock != null)
 profLock.release();
Mozilla.getInstance().termEmbedding();

the delete() method for the "parent.lock" file still returns me false.
I figured out what the problem was. The code
if (profLock != null)
 profLock.release();
works but you need a gui for this, meaning that in the Shutdownhook its already too late. I'm not sure why I need a gui (=mozilla??) to release the file.

This this a bug or a feature that .release() depends when it is called?
Assignee: jhpedemonte → nobody
Product: Core → Core Graveyard

JavaXPCOM was removed in bug 648593.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.