[gtk+] gdk: Remove overeager checks
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Remove overeager checks
- Date: Sun, 5 Oct 2014 10:04:05 +0000 (UTC)
commit 66be6a018c95e876b26b82e0648bb034c9307e79
Author: Benjamin Otte <otte redhat com>
Date: Sun Oct 5 11:18:15 2014 +0200
gdk: Remove overeager checks
Parent is guaranteed to not be NULL. It can only ever be NULL for root
windows and root windows cannot be created with gdk_window_new() and
gdk_window_ensure_native() will exit early because they already are
native.
Also, both functions would crash a few lines below where parent gets
dereferenced.
gdk/gdkwindow.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e023042..495ccd7 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1335,8 +1335,7 @@ gdk_window_new (GdkWindow *parent,
window->input_only = TRUE;
}
- if (window->parent)
- window->parent->children = g_list_prepend (window->parent->children, window);
+ window->parent->children = g_list_prepend (window->parent->children, window);
if (window->parent->window_type == GDK_WINDOW_ROOT)
{
@@ -1362,8 +1361,7 @@ gdk_window_new (GdkWindow *parent,
_gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes,
attributes_mask);
window->impl_window = window;
- if (parent)
- parent->impl_window->native_children = g_list_prepend (parent->impl_window->native_children, window);
+ parent->impl_window->native_children = g_list_prepend (parent->impl_window->native_children, window);
/* This will put the native window topmost in the native parent, which may
* be wrong wrt other native windows in the non-native hierarchy, so restack */
@@ -1712,9 +1710,8 @@ gdk_window_ensure_native (GdkWindow *window)
NULL, 0);
new_impl = window->impl;
- if (parent)
- parent->impl_window->native_children =
- g_list_prepend (parent->impl_window->native_children, window);
+ parent->impl_window->native_children =
+ g_list_prepend (parent->impl_window->native_children, window);
window->impl = old_impl;
change_impl (window, window, new_impl);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]