8021943: FileDialog getFile returns corrupted string after previous setFile

Reviewed-by: anthony, serb
This commit is contained in:
Alexander Zvegintsev 2013-09-04 14:32:13 +04:00 committed by Petr Pchelko
parent 22039ebd3e
commit 1530a30f52

@ -372,7 +372,9 @@ AwtFileDialog::Show(void *p)
// Report result to peer.
if (result) {
jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile);
jint length = multipleMode
? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile)
: (jint)_tcslen(ofn.lpstrFile);
jcharArray jnames = env->NewCharArray(length);
env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile);