Bug #747445 fixed - FileRequest "..." button does nothing on some State values

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2604 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-06-02 14:26:15 +00:00
parent e0423010c1
commit 76243e8769
2 changed files with 28 additions and 30 deletions

View file

@ -12,6 +12,7 @@
#include <atlbase.h> #include <atlbase.h>
#include <stdio.h> #include <stdio.h>
#include <commdlg.h> #include <commdlg.h>
#include <cderr.h>
#include "resource.h" #include "resource.h"
#include "../exdll/exdll.h" #include "../exdll/exdll.h"
@ -28,8 +29,7 @@ void FREE(void *d) { if (d) GlobalFree((HGLOBAL)d); }
char *STRDUP(const char *c) char *STRDUP(const char *c)
{ {
char *t=(char*)MALLOC(lstrlen(c)+1); char *t=(char*)MALLOC(lstrlen(c)+1);
lstrcpy(t,c); return lstrcpy(t,c);
return t;
} }
@ -179,24 +179,20 @@ bool BrowseForFile(int nControlIdx) {
GetWindowText(hControl, ofn.lpstrFile, MAX_PATH); GetWindowText(hControl, ofn.lpstrFile, MAX_PATH);
//for(;;) { tryagain:
if (pThisField->bSaveDlg) { if (pThisField->bSaveDlg) {
bResult = GetSaveFileName(&ofn); bResult = GetSaveFileName(&ofn);
} else { } else {
bResult = GetOpenFileName(&ofn); bResult = GetOpenFileName(&ofn);
} }
if (bResult) { if (bResult) {
SetWindowText(hControl, ofn.lpstrFile); SetWindowText(hControl, ofn.lpstrFile);
return true; return true;
} }
// check this because the dialog will sometimes return this error just because a directory is specified else if (ofn.lpstrFile[0] && CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
// instead of a filename. in this case, try it without the initial filename and see if that works. ofn.lpstrFile[0] = '\0';
// if (*(ofn.lpstrFile)) { //&& (CommDlgExtendedError() == FNERR_INVALIDFILENAME)) { goto tryagain;
// *(ofn.lpstrFile) = '\0'; }
// } else {
//break;
// }
//}
return false; return false;
} }
@ -1038,17 +1034,19 @@ void showCfgDlg()
FREE(pszCancelButtonText); FREE(pszCancelButtonText);
FREE(pszNextButtonText); FREE(pszNextButtonText);
FREE(pszBackButtonText); FREE(pszBackButtonText);
for (nIdx = 0; nIdx < nNumFields; nIdx++) {
FREE(pFields[nIdx].pszText); int i = nNumFields;
FREE(pFields[nIdx].pszState); while (i--) {
FREE(pFields[nIdx].pszListItems); FREE(pFields[i].pszText);
FREE(pFields[nIdx].pszFilter); FREE(pFields[i].pszState);
FREE(pFields[nIdx].pszRoot); FREE(pFields[i].pszListItems);
if (pFields[nIdx].nType == FIELD_BITMAP) { FREE(pFields[i].pszFilter);
DeleteObject(pFields[nIdx].hImage); FREE(pFields[i].pszRoot);
if (pFields[i].nType == FIELD_BITMAP) {
DeleteObject(pFields[i].hImage);
} }
if (pFields[nIdx].nType == FIELD_ICON) { if (pFields[i].nType == FIELD_ICON) {
DestroyIcon((HICON)pFields[nIdx].hImage); DestroyIcon((HICON)pFields[i].hImage);
} }
} }
FREE(pFields); FREE(pFields);

Binary file not shown.