[gimp/gimp-2-10] issue 3082: screenshot plugin crashes when cancelling...



commit a3813876626dddf090cd63aa7e2e27782bf6c88a
Author: Massimo Valentini <mvalentini335 gmail com>
Date:   Sat Jun 29 17:09:14 2019 +0200

    issue 3082: screenshot plugin crashes when cancelling...
    
    ...the interactive capture dialogue
    
    (cherry picked from commit 6c033317ac06103932f83f376a9a5d75148d5e67)

 plug-ins/screenshot/screenshot-win32.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-win32.c b/plug-ins/screenshot/screenshot-win32.c
index 567a33ba34..60f058b3f3 100644
--- a/plug-ins/screenshot/screenshot-win32.c
+++ b/plug-ins/screenshot/screenshot-win32.c
@@ -86,7 +86,7 @@ static gint32    *image_id;
 static void sendBMPToGimp                      (HBITMAP         hBMP,
                                                 HDC             hDC,
                                                 RECT            rect);
-static void     doWindowCapture                    (void);
+static int      doWindowCapture                    (void);
 static gboolean doCapture                          (HWND            selectedHwnd);
 static BOOL     isWindowIsAboveCaptureRegion       (HWND            hwndWindow,
                                                     RECT            rectCapture);
@@ -183,9 +183,7 @@ screenshot_win32_shoot (ScreenshotValues  *shootvals,
     }
   else if (shootvals->shoot_type == SHOOT_WINDOW)
     {
-      doWindowCapture ();
-
-      status = GIMP_PDB_SUCCESS;
+      status = 0 == doWindowCapture () ? GIMP_PDB_CANCEL : GIMP_PDB_SUCCESS;
     }
   else if (shootvals->shoot_type == SHOOT_REGION)
     {
@@ -352,7 +350,7 @@ sendBMPToGimp (HBITMAP hBMP,
  * ENTRY POINT FOR WINSNAP NONROOT
  *
  */
-static void
+static int
 doWindowCapture (void)
 {
   /* Start up a standard Win32
@@ -360,7 +358,7 @@ doWindowCapture (void)
    * selection of the window
    * to be captured
    */
-  winsnapWinMain ();
+  return winsnapWinMain ();
 }
 
 /******************************************************************
@@ -1260,7 +1258,7 @@ WndProc (HWND   hwnd,
       if (selectedHwnd)
         doCapture (selectedHwnd);
 
-      PostQuitMessage (0);
+      PostQuitMessage (selectedHwnd != NULL);
 
       break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]