Commit f734007a authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

added a bunch of checks for window != NULL and private->destroyed. (don't

Mon Jan 26 02:15:29 1998  Tim Janik  <timj@gimp.org>

        * gdk/gdkdraw.c:
        * gdk/gdkgc.c:
        * gdk/gdkimage.c:
        * gdk/gdkinput.c:
        * gdk/gdkpixmap.c:
        * gdk/gdkproperty.c:
        * gdk/gdkselection.c:
        * gdk/gdkwindow.c: added a bunch of checks for window != NULL and
          private->destroyed.
(don't trust this cvs commit message, i didn't modify that many files!)
parent 63f6c689
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
Mon Jan 26 02:15:29 1998 Tim Janik <timj@gimp.org>
* gdk/gdkdraw.c:
* gdk/gdkgc.c:
* gdk/gdkimage.c:
* gdk/gdkinput.c:
* gdk/gdkpixmap.c:
* gdk/gdkproperty.c:
* gdk/gdkselection.c:
* gdk/gdkwindow.c: added a bunch of checks for window != NULL and
private->destroyed.
Sun Jan 25 19:15:32 1998 Tim Janik <timj@gimp.org>
* gtk/gtkwidget.h (enum): added new widget flag GTK_LEAVE_PENDING.
......
......@@ -1248,7 +1248,7 @@ gdk_pointer_grab (GdkWindow * window,
xwindow = window_private->xwindow;
if (!confine_to)
if (!confine_to || confine_to_private->destroyed)
xconfine_to = None;
else
xconfine_to = confine_to_private->xwindow;
......@@ -1277,14 +1277,17 @@ gdk_pointer_grab (GdkWindow * window,
return_val = Success;;
if (return_val == Success)
return_val = XGrabPointer (window_private->xdisplay,
xwindow,
owner_events,
xevent_mask,
GrabModeAsync, GrabModeAsync,
xconfine_to,
xcursor,
time);
if (!window_private->destroyed)
return_val = XGrabPointer (window_private->xdisplay,
xwindow,
owner_events,
xevent_mask,
GrabModeAsync, GrabModeAsync,
xconfine_to,
xcursor,
time);
else
return_val = AlreadyGrabbed;
if (return_val == GrabSuccess)
xgrab_window = window_private;
......@@ -1371,11 +1374,14 @@ gdk_keyboard_grab (GdkWindow * window,
window_private = (GdkWindowPrivate*) window;
xwindow = window_private->xwindow;
return XGrabKeyboard (window_private->xdisplay,
xwindow,
owner_events,
GrabModeAsync, GrabModeAsync,
time);
if (!window_private->destroyed)
return XGrabKeyboard (window_private->xdisplay,
xwindow,
owner_events,
GrabModeAsync, GrabModeAsync,
time);
else
return AlreadyGrabbed;
}
/*
......
......@@ -34,6 +34,8 @@ gdk_draw_point (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
XDrawPoint (drawable_private->xdisplay, drawable_private->xwindow,
......@@ -55,6 +57,8 @@ gdk_draw_line (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
......@@ -77,6 +81,8 @@ gdk_draw_rectangle (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
if (width == -1)
......@@ -110,6 +116,8 @@ gdk_draw_arc (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
if (width == -1)
......@@ -139,6 +147,8 @@ gdk_draw_polygon (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
if (filled)
......@@ -183,6 +193,8 @@ gdk_draw_string (GdkDrawable *drawable,
g_return_if_fail (string != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
......@@ -237,6 +249,8 @@ gdk_draw_text (GdkDrawable *drawable,
g_return_if_fail (text != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
font_private = (GdkFontPrivate*) font;
......@@ -286,6 +300,8 @@ gdk_draw_pixmap (GdkDrawable *drawable,
drawable_private = (GdkWindowPrivate*) drawable;
src_private = (GdkWindowPrivate*) src;
if (drawable_private->destroyed || src_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
if (width == -1)
......@@ -346,6 +362,8 @@ gdk_draw_points (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
XDrawPoints (drawable_private->xdisplay,
......@@ -373,6 +391,8 @@ gdk_draw_segments (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
gc_private = (GdkGCPrivate*) gc;
XDrawSegments (drawable_private->xdisplay,
......
......@@ -32,17 +32,24 @@ gdk_gc_new_with_values (GdkWindow *window,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkWindowPrivate *window_private;
GdkGC *gc;
GdkGCPrivate *private;
Window xwindow;
XGCValues xvalues;
unsigned long xvalues_mask;
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return NULL;
private = g_new (GdkGCPrivate, 1);
gc = (GdkGC*) private;
xwindow = ((GdkWindowPrivate*) window)->xwindow;
private->xdisplay = ((GdkWindowPrivate*) window)->xdisplay;
xwindow = window_private->xwindow;
private->xdisplay = window_private->xdisplay;
xvalues.function = GXcopy;
xvalues.fill_style = FillSolid;
......@@ -512,15 +519,22 @@ gdk_gc_set_clip_mask (GdkGC *gc,
{
GdkGCPrivate *private;
Pixmap xmask;
g_return_if_fail (gc != NULL);
private = (GdkGCPrivate*) gc;
if (mask)
xmask = ((GdkWindowPrivate*) mask)->xwindow;
{
GdkWindowPrivate *mask_private;
mask_private = (GdkWindowPrivate*) mask;
if (mask_private->destroyed)
return;
xmask = mask_private->xwindow;
}
else
xmask = None;
private = (GdkGCPrivate*) gc;
XSetClipMask (private->xdisplay, private->xgc, xmask);
}
......
......@@ -330,6 +330,8 @@ gdk_image_get (GdkWindow *window,
g_return_val_if_fail (window != NULL, NULL);
win_private = (GdkWindowPrivate *) window;
if (win_private->destroyed)
return NULL;
private = g_new (GdkImagePrivate, 1);
image = (GdkImage*) private;
......@@ -447,6 +449,8 @@ gdk_image_put_normal (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
......@@ -478,6 +482,8 @@ gdk_image_put_shared (GdkDrawable *drawable,
g_return_if_fail (gc != NULL);
drawable_private = (GdkWindowPrivate*) drawable;
if (drawable_private->destroyed)
return;
image_private = (GdkImagePrivate*) image;
gc_private = (GdkGCPrivate*) gc;
......
......@@ -118,14 +118,20 @@ gdk_input_motion_events (GdkWindow *window,
guint32 stop,
gint *nevents_return)
{
GdkWindowPrivate *window_private;
XTimeCoord *xcoords;
GdkTimeCoord *coords;
int i;
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate *) window;
if (window_private->destroyed)
return NULL;
if (deviceid == GDK_CORE_POINTER)
{
xcoords = XGetMotionEvents (gdk_display,
((GdkWindowPrivate *)window)->xwindow,
window_private->xwindow,
start, stop, nevents_return);
if (xcoords)
{
......@@ -204,10 +210,14 @@ void
gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkExtensionMode mode)
{
GdkWindowPrivate *window_private;
GList *tmp_list;
GdkInputWindow *iw;
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
......@@ -224,7 +234,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
iw->grabbed = FALSE;
gdk_input_windows = g_list_append(gdk_input_windows,iw);
((GdkWindowPrivate *)window)->extension_events = mask;
window_private->extension_events = mask;
/* Add enter window events to the event mask */
/* FIXME, this is not needed for XINPUT_NONE */
......@@ -241,7 +251,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
g_free(iw);
}
((GdkWindowPrivate *)window)->extension_events = 0;
window_private->extension_events = 0;
}
for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
......
......@@ -46,14 +46,16 @@ gdk_pixmap_new (GdkWindow *window,
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return NULL;
if (depth == -1)
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
private = g_new (GdkWindowPrivate, 1);
pixmap = (GdkPixmap*) private;
window_private = (GdkWindowPrivate*) window;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
......@@ -87,11 +89,13 @@ gdk_bitmap_create_from_data (GdkWindow *window,
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return NULL;
private = g_new (GdkWindowPrivate, 1);
pixmap = (GdkPixmap*) private;
window_private = (GdkWindowPrivate*) window;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
......@@ -132,14 +136,16 @@ gdk_pixmap_create_from_data (GdkWindow *window,
if (!window)
window = (GdkWindow*) &gdk_root_parent;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return NULL;
if (depth == -1)
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
private = g_new (GdkWindowPrivate, 1);
pixmap = (GdkPixmap*) private;
window_private = (GdkWindowPrivate*) window;
private->parent = NULL;
private->xdisplay = window_private->xdisplay;
private->window_type = GDK_WINDOW_PIXMAP;
......
......@@ -67,7 +67,6 @@ gdk_property_get (GdkWindow *window,
gint *actual_length,
guchar **data)
{
GdkWindowPrivate *private;
Display *xdisplay;
Window xwindow;
Atom ret_prop_type;
......@@ -79,7 +78,12 @@ gdk_property_get (GdkWindow *window,
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
}
......@@ -156,13 +160,17 @@ gdk_property_change (GdkWindow *window,
guchar *data,
gint nelements)
{
GdkWindowPrivate *private;
Display *xdisplay;
Window xwindow;
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
}
......@@ -180,13 +188,17 @@ void
gdk_property_delete (GdkWindow *window,
GdkAtom property)
{
GdkWindowPrivate *private;
Display *xdisplay;
Window xwindow;
if (window)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
}
......
......@@ -29,13 +29,17 @@ gdk_selection_owner_set (GdkWindow *owner,
guint32 time,
gint send_event)
{
GdkWindowPrivate *private;
Display *xdisplay;
Window xwindow;
if (owner)
{
GdkWindowPrivate *private;
private = (GdkWindowPrivate*) owner;
if (private->destroyed)
return FALSE;
xdisplay = private->xdisplay;
xwindow = private->xwindow;
}
......@@ -73,6 +77,8 @@ gdk_selection_convert (GdkWindow *requestor,
g_return_if_fail (requestor != NULL);
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
return;
XConvertSelection (private->xdisplay, selection, target,
gdk_selection_property, private->xwindow, time);
......@@ -99,6 +105,8 @@ gdk_selection_property_get (GdkWindow *requestor,
moderate length, to avoid two round trips to the server */
private = (GdkWindowPrivate*) requestor;
if (private->destroyed)
return 0;
XGetWindowProperty (private->xdisplay, private->xwindow,
gdk_selection_property, 0, 0, False,
......
......@@ -103,6 +103,9 @@ gdk_window_new (GdkWindow *parent,
parent = (GdkWindow*) &gdk_root_parent;
parent_private = (GdkWindowPrivate*) parent;
if (parent_private->destroyed)
return NULL;
xparent = parent_private->xwindow;
parent_display = parent_private->xdisplay;
......@@ -508,12 +511,15 @@ gdk_window_move (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
XMoveWindow (private->xdisplay, private->xwindow, x, y);
if (private->window_type == GDK_WINDOW_CHILD)
if (!private->destroyed)
{
private->x = x;
private->y = y;
XMoveWindow (private->xdisplay, private->xwindow, x, y);
if (private->window_type == GDK_WINDOW_CHILD)
{
private->x = x;
private->y = y;
}
}
}
......@@ -566,15 +572,17 @@ gdk_window_move_resize (GdkWindow *window,
height = 1;
private = (GdkWindowPrivate*) window;
XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
if (!private->destroyed &&
(private->window_type == GDK_WINDOW_CHILD))
if (!private->destroyed)
{
private->x = x;
private->y = y;
private->width = width;
private->height = height;
XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
if (private->window_type == GDK_WINDOW_CHILD)
{
private->x = x;
private->y = y;
private->width = width;
private->height = height;
}
}
}
......@@ -595,10 +603,11 @@ gdk_window_reparent (GdkWindow *window,
window_private = (GdkWindowPrivate*) window;
parent_private = (GdkWindowPrivate*) new_parent;
XReparentWindow (window_private->xdisplay,
window_private->xwindow,
parent_private->xwindow,
x, y);
if (!window_private->destroyed && !parent_private->destroyed)
XReparentWindow (window_private->xdisplay,
window_private->xwindow,
parent_private->xwindow,
x, y);
}
void
......@@ -610,7 +619,8 @@ gdk_window_clear (GdkWindow *window)
private = (GdkWindowPrivate*) window;
XClearWindow (private->xdisplay, private->xwindow);
if (!private->destroyed)
XClearWindow (private->xdisplay, private->xwindow);
}
void
......@@ -621,11 +631,11 @@ gdk_window_clear_area (GdkWindow *window,
gint height)
{
GdkWindowPrivate *private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
XClearArea (private->xdisplay, private->xwindow,
x, y, width, height, False);
......@@ -641,9 +651,9 @@ gdk_window_clear_area_e (GdkWindow *window,
GdkWindowPrivate *private;
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
XClearArea (private->xdisplay, private->xwindow,
x, y, width, height, True);
......@@ -735,6 +745,9 @@ gdk_window_set_hints (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
size_hints.flags = 0;
if (flags & GDK_HINT_POS)
......@@ -771,8 +784,9 @@ gdk_window_set_title (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
XmbSetWMProperties (private->xdisplay, private->xwindow,
title, title, NULL, 0, NULL, NULL, NULL);
if (!private->destroyed)
XmbSetWMProperties (private->xdisplay, private->xwindow,
title, title, NULL, 0, NULL, NULL, NULL);
}
void
......@@ -784,7 +798,8 @@ gdk_window_set_background (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
XSetWindowBackground (private->xdisplay, private->xwindow, color->pixel);
if (!private->destroyed)
XSetWindowBackground (private->xdisplay, private->xwindow, color->pixel);
}
void
......@@ -809,7 +824,8 @@ gdk_window_set_back_pixmap (GdkWindow *window,
if (parent_relative)
xpixmap = ParentRelative;
XSetWindowBackgroundPixmap (window_private->xdisplay, window_private->xwindow, xpixmap);
if (!window_private->destroyed)
XSetWindowBackgroundPixmap (window_private->xdisplay, window_private->xwindow, xpixmap);
}
void
......@@ -830,7 +846,8 @@ gdk_window_set_cursor (GdkWindow *window,
else
xcursor = cursor_private->xcursor;
XDefineCursor (window_private->xdisplay, window_private->xwindow, xcursor);
if (!window_private->destroyed)
XDefineCursor (window_private->xdisplay, window_private->xwindow, xcursor);
}
void
......@@ -846,12 +863,15 @@ gdk_window_set_colormap (GdkWindow *window,
window_private = (GdkWindowPrivate*) window;
colormap_private = (GdkColormapPrivate*) colormap;
XSetWindowColormap (window_private->xdisplay,
window_private->xwindow,
colormap_private->xcolormap);
if (window_private->window_type != GDK_WINDOW_TOPLEVEL)
gdk_window_add_colormap_windows (window);
if (!window_private->destroyed)
{
XSetWindowColormap (window_private->xdisplay,
window_private->xwindow,
colormap_private->xcolormap);