diff options
author | Tim Janik <timj@gtk.org> | 1998-07-04 15:31:30 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-07-04 15:31:30 +0000 |
commit | 90408c4641e6493913eb859a67b3965bca259558 (patch) | |
tree | acdf9e671a8ca1307bb24099ce90ad59d1ac3185 /gdk | |
parent | c2eb7c28fe37ac83facf071451c4c2699e76cf1d (diff) | |
download | gtk+-90408c4641e6493913eb859a67b3965bca259558.tar.gz |
changed reversed_[12] to reserved_[12] in gtk_*_get_type functions.
Sat Jul 4 13:16:24 1998 Tim Janik <timj@gtk.org>
* gtk/*.c: changed reversed_[12] to reserved_[12] in gtk_*_get_type
functions.
* gdk/gdkwindow.c:
* gdk/gdkvisual.c: check for some pointer values to be != NULL, prior
to XFree() calls.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkinput.c | 2 | ||||
-rw-r--r-- | gdk/gdkproperty.c | 8 | ||||
-rw-r--r-- | gdk/gdkselection.c | 12 | ||||
-rw-r--r-- | gdk/gdkvisual.c | 3 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 16 | ||||
-rw-r--r-- | gdk/gxid.c | 5 | ||||
-rw-r--r-- | gdk/x11/gdkinput.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkproperty-x11.c | 8 | ||||
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 12 | ||||
-rw-r--r-- | gdk/x11/gdkvisual-x11.c | 3 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 16 | ||||
-rw-r--r-- | gdk/x11/gxid.c | 5 |
12 files changed, 68 insertions, 24 deletions
diff --git a/gdk/gdkinput.c b/gdk/gdkinput.c index 491131ca27..444d630efc 100644 --- a/gdk/gdkinput.c +++ b/gdk/gdkinput.c @@ -147,7 +147,7 @@ gdk_input_motion_events (GdkWindow *window, coords[i].ytilt = 0.0; } - XFree(xcoords); + XFree (xcoords); return coords; } diff --git a/gdk/gdkproperty.c b/gdk/gdkproperty.c index 36e3c22024..38665ca0c4 100644 --- a/gdk/gdkproperty.c +++ b/gdk/gdkproperty.c @@ -46,12 +46,16 @@ gdk_atom_name (GdkAtom atom) if (gdk_error_code == -1) { + if (t) + XFree (t); + return NULL; } else { name = g_strdup (t); - XFree (t); + if (t) + XFree (t); return name; } @@ -95,6 +99,7 @@ gdk_property_get (GdkWindow *window, xwindow = gdk_root_window; } + ret_data = NULL; XGetWindowProperty (xdisplay, xwindow, property, offset, (length + 3) / 4, pdelete, type, &ret_prop_type, &ret_format, @@ -113,6 +118,7 @@ gdk_property_get (GdkWindow *window, if (ret_prop_type != type) { gchar *rn, *pn; + XFree (ret_data); rn = gdk_atom_name(ret_prop_type); pn = gdk_atom_name(type); diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c index f1abc01cfb..fb89a3d85e 100644 --- a/gdk/gdkselection.c +++ b/gdk/gdkselection.c @@ -109,6 +109,7 @@ gdk_selection_property_get (GdkWindow *requestor, if (private->destroyed) return 0; + t = NULL; XGetWindowProperty (private->xdisplay, private->xwindow, gdk_selection_property, 0, 0, False, AnyPropertyType, &prop_type, &prop_format, @@ -125,7 +126,11 @@ gdk_selection_property_get (GdkWindow *requestor, return 0; } - XFree (t); + if (t) + { + t = NULL; + XFree (t); + } /* Add on an extra byte to handle null termination. X guarantees that t will be 1 longer than nbytes and null terminated */ @@ -144,7 +149,8 @@ gdk_selection_property_get (GdkWindow *requestor, { *data = g_new (guchar, length); memcpy (*data, t, length); - XFree (t); + if (t) + XFree (t); return length-1; } else @@ -205,6 +211,8 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format, void gdk_free_text_list (gchar **list) { + g_return_if_fail (list != NULL); + XFreeStringList (list); } diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c index a6a8b2b134..c471424f34 100644 --- a/gdk/gdkvisual.c +++ b/gdk/gdkvisual.c @@ -163,7 +163,8 @@ gdk_visual_init (void) } } - XFree (visual_list); + if (visual_list) + XFree (visual_list); for (i = 0; i < nvisuals; i++) { diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index ad19209751..6237c780f7 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -476,7 +476,8 @@ gdk_window_foreign_new (guint32 anid) /* FIXME: This is pretty expensive. Maybe the caller should supply * the parent */ XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren); - XFree (children); + if (children) + XFree (children); private->parent = gdk_xid_table_lookup (parent); parent_private = (GdkWindowPrivate *)private->parent; @@ -1449,7 +1450,8 @@ gdk_window_get_children (GdkWindow *window) children = g_list_prepend (children, child); } - XFree (xchildren); + if (xchildren) + XFree (xchildren); } return children; @@ -1525,17 +1527,20 @@ gdk_window_add_colormap_windows (GdkWindow *window) if (window_private->destroyed) return; + old_windows = NULL; if (!XGetWMColormapWindows (toplevel_private->xdisplay, toplevel_private->xwindow, &old_windows, &count)) { - old_windows = NULL; count = 0; } for (i = 0; i < count; i++) if (old_windows[i] == window_private->xwindow) - return; + { + XFree (old_windows); + return; + } new_windows = g_new (Window, count + 1); @@ -1949,7 +1954,8 @@ gdk_window_set_icon_name (GdkWindow *window, XSetWMIconName (window_private->xdisplay, window_private->xwindow, &property); - XFree(property.value); + if (property.value) + XFree (property.value); } void diff --git a/gdk/gxid.c b/gdk/gxid.c index 40b48fa31c..190eb0678f 100644 --- a/gdk/gxid.c +++ b/gdk/gxid.c @@ -267,8 +267,9 @@ gxi_find_root_child(Display *dpy, Window w) do { w = parent; - XQueryTree(dpy,w,&root,&parent,&children,&nchildren); - if (children) XFree(children); + XQueryTree (dpy, w, &root, &parent, &children, &nchildren); + if (children) + XFree (children); } while (parent != root); diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c index 491131ca27..444d630efc 100644 --- a/gdk/x11/gdkinput.c +++ b/gdk/x11/gdkinput.c @@ -147,7 +147,7 @@ gdk_input_motion_events (GdkWindow *window, coords[i].ytilt = 0.0; } - XFree(xcoords); + XFree (xcoords); return coords; } diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 36e3c22024..38665ca0c4 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -46,12 +46,16 @@ gdk_atom_name (GdkAtom atom) if (gdk_error_code == -1) { + if (t) + XFree (t); + return NULL; } else { name = g_strdup (t); - XFree (t); + if (t) + XFree (t); return name; } @@ -95,6 +99,7 @@ gdk_property_get (GdkWindow *window, xwindow = gdk_root_window; } + ret_data = NULL; XGetWindowProperty (xdisplay, xwindow, property, offset, (length + 3) / 4, pdelete, type, &ret_prop_type, &ret_format, @@ -113,6 +118,7 @@ gdk_property_get (GdkWindow *window, if (ret_prop_type != type) { gchar *rn, *pn; + XFree (ret_data); rn = gdk_atom_name(ret_prop_type); pn = gdk_atom_name(type); diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index f1abc01cfb..fb89a3d85e 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -109,6 +109,7 @@ gdk_selection_property_get (GdkWindow *requestor, if (private->destroyed) return 0; + t = NULL; XGetWindowProperty (private->xdisplay, private->xwindow, gdk_selection_property, 0, 0, False, AnyPropertyType, &prop_type, &prop_format, @@ -125,7 +126,11 @@ gdk_selection_property_get (GdkWindow *requestor, return 0; } - XFree (t); + if (t) + { + t = NULL; + XFree (t); + } /* Add on an extra byte to handle null termination. X guarantees that t will be 1 longer than nbytes and null terminated */ @@ -144,7 +149,8 @@ gdk_selection_property_get (GdkWindow *requestor, { *data = g_new (guchar, length); memcpy (*data, t, length); - XFree (t); + if (t) + XFree (t); return length-1; } else @@ -205,6 +211,8 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format, void gdk_free_text_list (gchar **list) { + g_return_if_fail (list != NULL); + XFreeStringList (list); } diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index a6a8b2b134..c471424f34 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -163,7 +163,8 @@ gdk_visual_init (void) } } - XFree (visual_list); + if (visual_list) + XFree (visual_list); for (i = 0; i < nvisuals; i++) { diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index ad19209751..6237c780f7 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -476,7 +476,8 @@ gdk_window_foreign_new (guint32 anid) /* FIXME: This is pretty expensive. Maybe the caller should supply * the parent */ XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren); - XFree (children); + if (children) + XFree (children); private->parent = gdk_xid_table_lookup (parent); parent_private = (GdkWindowPrivate *)private->parent; @@ -1449,7 +1450,8 @@ gdk_window_get_children (GdkWindow *window) children = g_list_prepend (children, child); } - XFree (xchildren); + if (xchildren) + XFree (xchildren); } return children; @@ -1525,17 +1527,20 @@ gdk_window_add_colormap_windows (GdkWindow *window) if (window_private->destroyed) return; + old_windows = NULL; if (!XGetWMColormapWindows (toplevel_private->xdisplay, toplevel_private->xwindow, &old_windows, &count)) { - old_windows = NULL; count = 0; } for (i = 0; i < count; i++) if (old_windows[i] == window_private->xwindow) - return; + { + XFree (old_windows); + return; + } new_windows = g_new (Window, count + 1); @@ -1949,7 +1954,8 @@ gdk_window_set_icon_name (GdkWindow *window, XSetWMIconName (window_private->xdisplay, window_private->xwindow, &property); - XFree(property.value); + if (property.value) + XFree (property.value); } void diff --git a/gdk/x11/gxid.c b/gdk/x11/gxid.c index 40b48fa31c..190eb0678f 100644 --- a/gdk/x11/gxid.c +++ b/gdk/x11/gxid.c @@ -267,8 +267,9 @@ gxi_find_root_child(Display *dpy, Window w) do { w = parent; - XQueryTree(dpy,w,&root,&parent,&children,&nchildren); - if (children) XFree(children); + XQueryTree (dpy, w, &root, &parent, &children, &nchildren); + if (children) + XFree (children); } while (parent != root); |