1 commit 33da74a9ab13bba4f46b2455cc858c7ae02bd923
2 Author: Cody Russell <cody@jhu.edu>
3 Date: Mon Mar 31 08:51:25 2014 -0500
5 This is an attempt to solve an issue in GtkNSView that occurs in
6 Xamarin Studio when we try to use an animating NSProgressIndicator.
7 The error only occurred if the indicator was in animating mode,
8 and it seems likely to be a threading race condition somewhere.
10 This patch does two things. I've found the issue to be reproducible
11 if we do one of these things but not the other, but I have not been
12 able to reproduce it with both of these.
14 First, we slightly defer the mapping of the widget.
15 Second, we lock the view during clip_to_parent_viewports().
17 https://bugzilla.xamarin.com/show_bug.cgi?id=17401
19 diff --git a/gtk/gtknsview.c b/gtk/gtknsview.c
20 index d5eb307..31c4970 100644
23 @@ -280,6 +280,7 @@ clip_to_parent_viewports (GtkNSView *ns_view,
25 ns_view = get_associated_gtknsview (self);
27 + [self lockFocusIfCanDraw];
29 cg_context = clip_to_parent_viewports (ns_view, self);
31 @@ -287,6 +288,8 @@ clip_to_parent_viewports (GtkNSView *ns_view,
34 CGContextRestoreGState (cg_context);
40 @@ -566,15 +569,17 @@ gtk_ns_view_unrealize (GtkWidget *widget)
41 GTK_WIDGET_CLASS (gtk_ns_view_parent_class)->unrealize (widget);
45 -gtk_ns_view_map (GtkWidget *widget)
48 +really_map (GtkWidget *widget) {
49 GtkNSView *ns_view = GTK_NS_VIEW (widget);
50 GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
51 GtkAllocation allocation;
55 + if (gtk_widget_get_mapped (widget))
58 gtk_widget_get_allocation (widget, &allocation);
59 gtk_ns_view_position_view (ns_view, &allocation);
61 @@ -605,6 +610,14 @@ gtk_ns_view_map (GtkWidget *widget)
62 gtk_ns_view_swizzle_draw_rect_recursive (text, "gtkwindow", toplevel);
70 +gtk_ns_view_map (GtkWidget *widget)
72 + g_timeout_add (50, (GSourceFunc)really_map, widget);