gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

Mac version causes Unity to freeze when opening files with any extension filter on it #8

Closed cchengVA closed 6 years ago

cchengVA commented 7 years ago

Unless an empty extension filter string is passed to the call to DialogOpenFilePanel, that call will immediately lock up Unity with zero means to recover it. No open dialog pops up, and neither does any error messages.

I'm not a good enough Mac developer to be able to root through the exact causes, however I feel the cause lies somewhere in the Plugin you provide, rather than anywhere in Unity's space.

cchengVA commented 7 years ago

Almost forgot; using Unity 5.5.0f3. The Mac I'm using to test this with is on version 10.9.5.

cchengVA commented 7 years ago

...my apologies, my inexperience with Mac led me to believe there were no logs. I just found them.


*** First throw call stack:  
0  CoreFoundation         __exceptionPreprocess + 172  
1  lobobjc.A.dylib        objc_exception_throw + 43
2  CoreFoundation         -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3  CoreFoundation         ___forwarding___ + 1010
4  CoreFoundation         _CF_forwarding_prep_0 + 120
5  StandaloneFileBrowser  -[StandaloneFileBrowser dialogOpenFilePanel:director:filters:multiselect:canChooseFiles:canChooseFolders:] + 746
6  StandaloneFileBrowser  DialogOpenFilePanel + 178  

...all the way to the start of the application.
gkngkc commented 7 years ago

Hi,

You're right, i just tested it and calling open file method like

var extensions = new [] { new ExtensionFilter("All Files") }; StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, true);

causes a objective-c exception and its crashes editor/app.

I'm going to add a safe parse check or an exception handler to prevent this whenever i have free time. Until then don't forget to add at least one extension (For ex: "*") to filter

Thank you for your feedback

cchengVA commented 7 years ago

I should probably mention, that even with the sample you provided, unmodified, it was still locking up Unity when trying to create an open file dialog with any filter...

I should also mention, this isn't an issue of a malformed filter causing a lockup. This is an issue of using a filter causing a lockup.

erikpg commented 7 years ago

I'm seeing the same issue here.

gkngkc commented 7 years ago

This should be fixed with https://github.com/gkngkc/UnityStandaloneFileBrowser/commit/168cacb2e9afeb68bc00f97c21ddd467ee723a5e.

Sorry for the late fix, it was an issue with a method unavailable mac os < 10.11.

erikpg commented 7 years ago

Awesome!! It is working great now. Thanks a lot 👍