提交 019262a4 编写于 作者: A alexsch

7199708: FileChooser crashs when opening large folder

Reviewed-by: bagiras
上级 a469d6d9
...@@ -1099,7 +1099,7 @@ final class Win32ShellFolder2 extends ShellFolder { ...@@ -1099,7 +1099,7 @@ final class Win32ShellFolder2 extends ShellFolder {
? SwingConstants.CENTER ? SwingConstants.CENTER
: SwingConstants.LEADING); : SwingConstants.LEADING);
column.setComparator(new ColumnComparator(getIShellFolder(), i)); column.setComparator(new ColumnComparator(Win32ShellFolder2.this, i));
notNullColumns.add(column); notNullColumns.add(column);
} }
...@@ -1135,7 +1135,7 @@ final class Win32ShellFolder2 extends ShellFolder { ...@@ -1135,7 +1135,7 @@ final class Win32ShellFolder2 extends ShellFolder {
// synchronize the whole code of the sort method once // synchronize the whole code of the sort method once
invoke(new Callable<Void>() { invoke(new Callable<Void>() {
public Void call() { public Void call() {
Collections.sort(files, new ColumnComparator(getIShellFolder(), 0)); Collections.sort(files, new ColumnComparator(Win32ShellFolder2.this, 0));
return null; return null;
} }
...@@ -1143,12 +1143,12 @@ final class Win32ShellFolder2 extends ShellFolder { ...@@ -1143,12 +1143,12 @@ final class Win32ShellFolder2 extends ShellFolder {
} }
private static class ColumnComparator implements Comparator<File> { private static class ColumnComparator implements Comparator<File> {
private final long parentIShellFolder; private final Win32ShellFolder2 shellFolder;
private final int columnIdx; private final int columnIdx;
public ColumnComparator(long parentIShellFolder, int columnIdx) { public ColumnComparator(Win32ShellFolder2 shellFolder, int columnIdx) {
this.parentIShellFolder = parentIShellFolder; this.shellFolder = shellFolder;
this.columnIdx = columnIdx; this.columnIdx = columnIdx;
} }
...@@ -1159,7 +1159,7 @@ final class Win32ShellFolder2 extends ShellFolder { ...@@ -1159,7 +1159,7 @@ final class Win32ShellFolder2 extends ShellFolder {
if (o instanceof Win32ShellFolder2 if (o instanceof Win32ShellFolder2
&& o1 instanceof Win32ShellFolder2) { && o1 instanceof Win32ShellFolder2) {
// delegates comparison to native method // delegates comparison to native method
return compareIDsByColumn(parentIShellFolder, return compareIDsByColumn(shellFolder.getIShellFolder(),
((Win32ShellFolder2) o).getRelativePIDL(), ((Win32ShellFolder2) o).getRelativePIDL(),
((Win32ShellFolder2) o1).getRelativePIDL(), ((Win32ShellFolder2) o1).getRelativePIDL(),
columnIdx); columnIdx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册