mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 660586 - Prevent hangs when selecting a large number of files in MacOS X file picker. r=joshmoz
This commit is contained in:
parent
42d1a4c2b4
commit
271cf17825
@ -399,15 +399,24 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsC
|
||||
if (result == NSFileHandlingPanelCancelButton)
|
||||
return retVal;
|
||||
|
||||
// append each chosen file to our list
|
||||
for (unsigned int i = 0; i < [[thePanel URLs] count]; i++) {
|
||||
NSURL *theURL = [[thePanel URLs] objectAtIndex:i];
|
||||
if (theURL) {
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
|
||||
nsCOMPtr<nsILocalFileMac> macLocalFile = do_QueryInterface(localFile);
|
||||
if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)theURL)))
|
||||
outFiles.AppendObject(localFile);
|
||||
// Converts data from a NSArray of NSURL to the returned format.
|
||||
// We should be careful to not call [thePanel URLs] more than once given that
|
||||
// it creates a new array each time.
|
||||
// TODO: we should use Fast Enumeration as soon as Obj-C 2.0 is allowed in
|
||||
// our code.
|
||||
NSArray* urls = [thePanel URLs];
|
||||
|
||||
for (unsigned int i = 0; i < [urls count]; ++i) {
|
||||
NSURL* url = [urls objectAtIndex:i];
|
||||
if (!url) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
|
||||
nsCOMPtr<nsILocalFileMac> macLocalFile = do_QueryInterface(localFile);
|
||||
if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)url))) {
|
||||
outFiles.AppendObject(localFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user