Bug 1444379 - Follow-up: move prompt retrieval to where prompt is used. r=aceman DONTBUILD
authorJorg K <jorgk@jorgk.com>
Sun, 30 Sep 2018 11:50:22 +0200
changeset 33274 d55e51bddfae74108d4a6b78d6fb59920bc3ae8e
parent 33273 390588f44e2bb7b269c20a44b90cefe121e9adaf
child 33275 8f55290ad6a2e240b1fa5029813876f9588a09d0
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersaceman
bugs1444379
Bug 1444379 - Follow-up: move prompt retrieval to where prompt is used. r=aceman DONTBUILD
mailnews/compose/src/nsMsgSend.cpp
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -3764,30 +3764,29 @@ nsMsgComposeAndSend::GetMessageId(nsACSt
   else
     rv = NS_ERROR_NULL_POINTER;
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgComposeAndSend::NotifyListenerOnStopCopy(nsresult aStatus)
 {
+  nsresult rv;
+
   // This is one per copy so make sure we clean this up first.
   mCopyObj = nullptr;
 
   // Set a status message...
   nsString msg;
   if (NS_SUCCEEDED(aStatus))
     mComposeBundle->GetStringFromName("copyMessageComplete", msg);
   else
     mComposeBundle->GetStringFromName("copyMessageFailed", msg);
 
   SetStatusMessage(msg);
-  nsCOMPtr<nsIPrompt> prompt;
-  nsresult rv = GetDefaultPrompt(getter_AddRefs(prompt));
-  NS_ENSURE_SUCCESS(rv, rv);
 
   if (NS_FAILED(aStatus))
   {
     nsCOMPtr<nsIStringBundleService> bundleService =
       mozilla::services::GetStringBundleService();
     NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
     nsCOMPtr<nsIStringBundle> bundle;
     rv = bundleService->CreateBundle("chrome://messenger/locale/messengercompose/composeMsgs.properties", getter_AddRefs(bundle));
@@ -3859,16 +3858,20 @@ nsMsgComposeAndSend::NotifyListenerOnSto
     int32_t buttonPressed = 0;
     bool showCheckBox = false;
     uint32_t buttonFlags = (nsIPrompt::BUTTON_POS_0 * nsIPrompt::BUTTON_TITLE_IS_STRING) +
                            (nsIPrompt::BUTTON_POS_1 * nsIPrompt::BUTTON_TITLE_DONT_SAVE) +
                            (nsIPrompt::BUTTON_POS_2 * nsIPrompt::BUTTON_TITLE_SAVE);
     nsString dialogTitle, buttonLabelRetry;
     bundle->GetStringFromName("SaveDialogTitle", dialogTitle);
     bundle->GetStringFromName("buttonLabelRetry2", buttonLabelRetry);
+
+    nsCOMPtr<nsIPrompt> prompt;
+    rv = GetDefaultPrompt(getter_AddRefs(prompt));
+    NS_ENSURE_SUCCESS(rv, rv);
     prompt->ConfirmEx(dialogTitle.get(), msg.get(), buttonFlags, buttonLabelRetry.get(),
                       nullptr, nullptr, nullptr, &showCheckBox, &buttonPressed);
     if (buttonPressed == 0)
     {
       // retry button clicked
       mSendProgress = nullptr; // this was canceled, so we need to clear it.
       return SendToMagicFolder(m_deliver_mode);
     }