If you don't get an nsIFileWidget, don't just go ahead and call methods on it.

This commit is contained in:
sfraser@netscape.com
1999-05-07 04:54:43 +00:00
parent 87b273c973
commit adc4de79cc
2 changed files with 32 additions and 26 deletions

View File

@@ -154,25 +154,28 @@ void nsFileControlFrame::MouseClicked(nsIPresContext* aPresContext)
textView->GetParent(parentView);
nsIWidget* parentWidget = GetWindowTemp(parentView);
nsIFileWidget *fileWidget;
nsIFileWidget *fileWidget = nsnull;
nsString title("File Upload");
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
if (fileWidget)
{
nsString titles[] = {"all files"};
nsString filters[] = {"*.*"};
fileWidget->SetFilterList(1, titles, filters);
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
result = fileWidget->Show();
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
if (result) {
PRUint32 size;
nsString fileName;
fileWidget->GetFile(fileName);
textWidget->SetText(fileName,size);
}
NS_RELEASE(fileWidget);
}
NS_RELEASE(fileWidget);
NS_RELEASE(parentWidget);
NS_RELEASE(textWidget);
NS_RELEASE(widget);