Subject: Re: bug#56559: 29.0.50; Invalid CGContextSaveState on NS

From: Gerd Möllmann <[email-masked]>
Date: Fri, 15 Jul 2022 15:25:01 +0200

Can I please ask another question?  You seem to be the only one here knowing the NS stuff.

I'm looking at the ns_focus/ns_unfocus stuff,.  From just eading the code, it appears to me that nested calls liek so:

  1 ns_focus          in ns_draw_window_cursor
  2   ns_focus        in draw_.*
  3   ns_unfocus      in draw_.*
  4   ...
  5 ns_unfocus        in ns_draw_window_cursor

are not supported, or is the intention that they are?

My hypthesis is the ns_unfocus in line 3 above undoes the ns_focus from line 1, or parts thereof, I haven't checked that thoroughly.

To make that a theory, I've added an ns_focus like so

      ns_focus(f, NULL, 0);
      [NSBezierPath strokeRect:NSInsetRect(r, 0.5, 0.5)];

and voilà the error is gone.