[gimp] issue 3082: screenshot plugin crashes when cancelling...



commit 6c033317ac06103932f83f376a9a5d75148d5e67
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

 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 048d43e38c..a72db45eee 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]