]> git.eshelyaron.com Git - emacs.git/commitdiff
Fixes: 19036
authorJan Djärv <jan.h.d@swipnet.se>
Fri, 14 Nov 2014 07:41:53 +0000 (08:41 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Fri, 14 Nov 2014 07:41:53 +0000 (08:41 +0100)
* nsfns.m (x_set_foreground_color, x_set_background_color)
(x_set_cursor_color, Fxw_color_values): Block/unblock input,
use SET_FRAME_GARBAGED instead of redraw_frame (Bug#19036).

src/ChangeLog
src/nsfns.m

index 719ccec467da252094947cf06e418a1f43b80469..d75a7ec124b8d039a02ad06b32f96fb387c59266 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsfns.m (x_set_foreground_color, x_set_background_color)
+       (x_set_cursor_color, Fxw_color_values): Block/unblock input,
+       use SET_FRAME_GARBAGED instead of redraw_frame (Bug#19036).
+
 2014-11-09  Eli Zaretskii  <eliz@gnu.org>
 
        * fileio.c (Finsert_file_contents): Invalidate buffer caches also
index 8129c9e2a41cf2f20bafd664754200d85d6eff29..e0f8cfee14a5993bd20b44eedd624d2959244ea7 100644 (file)
@@ -282,9 +282,14 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   NSColor *col;
   EmacsCGFloat r, g, b, alpha;
 
+  /* Must block_input, because ns_lisp_to_color does block/unblock_input
+     which means that col may be deallocated in its unblock_input if there
+     is user input, unless we also block_input.  */
+  block_input ();
   if (ns_lisp_to_color (arg, &col))
     {
       store_frame_param (f, Qforeground_color, oldval);
+      unblock_input ();
       error ("Unknown color");
     }
 
@@ -301,8 +306,9 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
       update_face_from_frame_parameter (f, Qforeground_color, arg);
       /*recompute_basic_faces (f); */
       if (FRAME_VISIBLE_P (f))
-        redraw_frame (f);
+        SET_FRAME_GARBAGED (f);
     }
+  unblock_input ();
 }
 
 
@@ -314,9 +320,11 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   NSView *view = FRAME_NS_VIEW (f);
   EmacsCGFloat r, g, b, alpha;
 
+  block_input ();
   if (ns_lisp_to_color (arg, &col))
     {
       store_frame_param (f, Qbackground_color, oldval);
+      unblock_input ();
       error ("Unknown color");
     }
 
@@ -353,8 +361,9 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
         }
 
       if (FRAME_VISIBLE_P (f))
-        redraw_frame (f);
+        SET_FRAME_GARBAGED (f);
     }
+  unblock_input ();
 }
 
 
@@ -363,9 +372,11 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   NSColor *col;
 
+  block_input ();
   if (ns_lisp_to_color (arg, &col))
     {
       store_frame_param (f, Qcursor_color, oldval);
+      unblock_input ();
       error ("Unknown color");
     }
 
@@ -378,6 +389,7 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
       x_update_cursor (f, 1);
     }
   update_face_from_frame_parameter (f, Qcursor_color, arg);
+  unblock_input ();
 }
 
 
@@ -2298,11 +2310,16 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
   check_window_system (NULL);
   CHECK_STRING (color);
 
+  block_input ();
   if (ns_lisp_to_color (color, &col))
-    return Qnil;
+    {
+      unblock_input ();
+      return Qnil;
+    }
 
   [[col colorUsingDefaultColorSpace]
         getRed: &red green: &green blue: &blue alpha: &alpha];
+  unblock_input ();
   return list3i (lrint (red * 65280), lrint (green * 65280),
                 lrint (blue * 65280));
 }