6621569: Win32ShellFolder2 and Win32ShellFolderManager2 may leak native resources
Reviewed-by: malenkov
This commit is contained in:
parent
fcfa835d86
commit
e918d4b860
@ -693,6 +693,7 @@ final class Win32ShellFolder2 extends ShellFolder {
|
||||
ArrayList<Win32ShellFolder2> list = new ArrayList<Win32ShellFolder2>();
|
||||
long pEnumObjects = getEnumObjects(includeHiddenFiles);
|
||||
if (pEnumObjects != 0) {
|
||||
try {
|
||||
long childPIDL;
|
||||
int testedAttrs = ATTRIB_FILESYSTEM | ATTRIB_FILESYSANCESTOR;
|
||||
do {
|
||||
@ -715,8 +716,10 @@ final class Win32ShellFolder2 extends ShellFolder {
|
||||
releasePIDL(childPIDL);
|
||||
}
|
||||
} while (childPIDL != 0 && !Thread.currentThread().isInterrupted());
|
||||
} finally {
|
||||
releaseEnumObjects(pEnumObjects);
|
||||
}
|
||||
}
|
||||
return Thread.currentThread().isInterrupted()
|
||||
? new File[0]
|
||||
: list.toArray(new ShellFolder[list.size()]);
|
||||
|
@ -79,9 +79,12 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
|
||||
// Shouldn't happen but watch for it anyway
|
||||
throw new FileNotFoundException("File " + file.getAbsolutePath() + " not found");
|
||||
}
|
||||
Win32ShellFolder2 folder = createShellFolderFromRelativePIDL(parent, pIDL);
|
||||
|
||||
try {
|
||||
return createShellFolderFromRelativePIDL(parent, pIDL);
|
||||
} finally {
|
||||
Win32ShellFolder2.releasePIDL(pIDL);
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
|
||||
static Win32ShellFolder2 createShellFolderFromRelativePIDL(Win32ShellFolder2 parent, long pIDL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user