GdkDisplay: Call the correct push|pop_error_trap()
It is wrong to assume all Displays are of the same class as the default. https://bugzilla.gnome.org/show_bug.cgi?id=784016
This commit is contained in:

committed by
Daniel Boles

parent
99c8e30c02
commit
0721dad970
@ -2301,41 +2301,38 @@ void
|
|||||||
gdk_error_trap_push (void)
|
gdk_error_trap_push (void)
|
||||||
{
|
{
|
||||||
GdkDisplayManager *manager;
|
GdkDisplayManager *manager;
|
||||||
GdkDisplayClass *class;
|
|
||||||
GdkGlobalErrorTrap *trap;
|
GdkGlobalErrorTrap *trap;
|
||||||
|
GSList *displays;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
manager = gdk_display_manager_get ();
|
manager = gdk_display_manager_get ();
|
||||||
class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
|
displays = gdk_display_manager_list_displays (manager);
|
||||||
|
|
||||||
if (class->push_error_trap == NULL)
|
trap = g_slice_new0 (GdkGlobalErrorTrap);
|
||||||
return;
|
for (l = displays; l != NULL; l = l->next)
|
||||||
|
{
|
||||||
|
GdkDisplay *display = l->data;
|
||||||
|
GdkDisplayClass *class = GDK_DISPLAY_GET_CLASS (display);
|
||||||
|
|
||||||
trap = g_slice_new (GdkGlobalErrorTrap);
|
if (class->push_error_trap != NULL)
|
||||||
trap->displays = gdk_display_manager_list_displays (manager);
|
{
|
||||||
|
class->push_error_trap (display);
|
||||||
g_slist_foreach (trap->displays, (GFunc) g_object_ref, NULL);
|
trap->displays = g_slist_prepend (trap->displays, g_object_ref (display));
|
||||||
for (l = trap->displays; l != NULL; l = l->next)
|
}
|
||||||
class->push_error_trap (l->data);
|
}
|
||||||
|
|
||||||
g_queue_push_head (&gdk_error_traps, trap);
|
g_queue_push_head (&gdk_error_traps, trap);
|
||||||
|
|
||||||
|
g_slist_free (displays);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
gdk_error_trap_pop_internal (gboolean need_code)
|
gdk_error_trap_pop_internal (gboolean need_code)
|
||||||
{
|
{
|
||||||
GdkDisplayManager *manager;
|
|
||||||
GdkDisplayClass *class;
|
|
||||||
GdkGlobalErrorTrap *trap;
|
GdkGlobalErrorTrap *trap;
|
||||||
gint result;
|
gint result;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
manager = gdk_display_manager_get ();
|
|
||||||
class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
|
|
||||||
|
|
||||||
if (class->pop_error_trap == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
trap = g_queue_pop_head (&gdk_error_traps);
|
trap = g_queue_pop_head (&gdk_error_traps);
|
||||||
|
|
||||||
g_return_val_if_fail (trap != NULL, 0);
|
g_return_val_if_fail (trap != NULL, 0);
|
||||||
@ -2343,7 +2340,9 @@ gdk_error_trap_pop_internal (gboolean need_code)
|
|||||||
result = 0;
|
result = 0;
|
||||||
for (l = trap->displays; l != NULL; l = l->next)
|
for (l = trap->displays; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
gint code = class->pop_error_trap (l->data, !need_code);
|
GdkDisplay *display = l->data;
|
||||||
|
GdkDisplayClass *class = GDK_DISPLAY_GET_CLASS (display);
|
||||||
|
gint code = class->pop_error_trap (display, !need_code);
|
||||||
|
|
||||||
/* we use the error on the last display listed, why not. */
|
/* we use the error on the last display listed, why not. */
|
||||||
if (code != 0)
|
if (code != 0)
|
||||||
|
Reference in New Issue
Block a user