Fix potential crash in T3656 workaround
authorAndre Heinecke <aheinecke@intevation.de>
Wed, 22 Aug 2018 08:51:42 +0000 (10:51 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Wed, 22 Aug 2018 08:51:42 +0000 (10:51 +0200)
* src/windowmessages.cpp (CLOSE): Use the currentViewRef trick
to avoid unload in close.

--
The workaround codepath crashed reliably for me with the
async sending. But with the current item ref trick it no
longer crashes as the unload is later. My observation is
that any Invoke that triggers an Unload can crash so we
better avoid it.

GnuPG-Bug-Id: T3656

src/windowmessages.cpp

index afb8197..e3dfd45 100644 (file)
@@ -132,7 +132,11 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                              SRCNAME, __func__);
                   break;
                 }
+              mail->refCurrentItem();
               Mail::close (mail);
+              log_debug ("%s:%s: Close finished.",
+                         SRCNAME, __func__);
+              mail->releaseCurrentItem();
               break;
             }
           case (CRYPTO_DONE):