diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 8ff6c1e7468..83289aa1032 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -131,6 +131,7 @@ nsFileControlFrame::Destroy(nsIPresContext* aPresContext) nsCOMPtr fileInput = do_QueryInterface(mContent); fileInput->TakeTextFrameValue(value); } + mTextFrame = nsnull; return nsAreaFrame::Destroy(aPresContext); } @@ -324,6 +325,11 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) if (mode == nsIFilePicker::returnCancel) return NS_OK; + if (!mTextFrame) { + // We got destroyed while the filepicker was up. Don't do anything here. + return NS_OK; + } + // Set property nsCOMPtr localFile; result = filePicker->GetFile(getter_AddRefs(localFile)); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 8ff6c1e7468..83289aa1032 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -131,6 +131,7 @@ nsFileControlFrame::Destroy(nsIPresContext* aPresContext) nsCOMPtr fileInput = do_QueryInterface(mContent); fileInput->TakeTextFrameValue(value); } + mTextFrame = nsnull; return nsAreaFrame::Destroy(aPresContext); } @@ -324,6 +325,11 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) if (mode == nsIFilePicker::returnCancel) return NS_OK; + if (!mTextFrame) { + // We got destroyed while the filepicker was up. Don't do anything here. + return NS_OK; + } + // Set property nsCOMPtr localFile; result = filePicker->GetFile(getter_AddRefs(localFile));