Commit eacc9f5d authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor
Browse files

Reverted global changes of g_new to malloc(), added back in the one place

Tue Sep 15 13:09:24 1998  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkimage.c (gdk_image_new): Reverted global changes
	of g_new to malloc(), added back in the one place where
	it actually mattered. #include <stdlib.h>.

	* gdk/gdkrgb.c: g_malloc() to malloc() as above.
parent a2524578
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
Tue Sep 15 13:09:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Reverted global changes
of g_new to malloc(), added back in the one place where
it actually mattered. #include <stdlib.h>.
* gdk/gdkrgb.c: g_malloc() to malloc() as above.
Tue Sep 15 11:30:03 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkfilesel.c: Keep a list of directories in which we never
want to stat the entries (like /afs), and assume everything in
those directories is a subdirectory.
- When following a path, try to open components even when
we don't find them in their parent's directory to
support automounters.
Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com> Tue Sep 15 11:06:13 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Don't request * gtk/gtkwindow.c (gtk_window_move_resize): Don't request
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "../config.h" #include "../config.h"
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H) #if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
...@@ -84,7 +85,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h) ...@@ -84,7 +85,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
Visual *xvisual; Visual *xvisual;
GdkImage *image; GdkImage *image;
GdkImagePrivate *private; GdkImagePrivate *private;
private = malloc (sizeof (GdkImagePrivate)); private = g_new(GdkImagePrivate, 1);
image = (GdkImage *) private; image = (GdkImage *) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
private->image_put = gdk_image_put_normal; private->image_put = gdk_image_put_normal;
...@@ -165,7 +166,7 @@ gdk_image_new (GdkImageType type, ...@@ -165,7 +166,7 @@ gdk_image_new (GdkImageType type,
break; break;
default: default:
private = malloc (sizeof (GdkImagePrivate)); private = g_new (GdkImagePrivate, 1);
image = (GdkImage*) private; image = (GdkImage*) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
...@@ -187,7 +188,7 @@ gdk_image_new (GdkImageType type, ...@@ -187,7 +188,7 @@ gdk_image_new (GdkImageType type,
{ {
private->image_put = gdk_image_put_shared; private->image_put = gdk_image_put_shared;
private->x_shm_info = malloc (sizeof (XShmSegmentInfo)); private->x_shm_info = g_new (XShmSegmentInfo, 1);
x_shm_info = private->x_shm_info; x_shm_info = private->x_shm_info;
private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth, private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth,
...@@ -196,7 +197,7 @@ gdk_image_new (GdkImageType type, ...@@ -196,7 +197,7 @@ gdk_image_new (GdkImageType type,
{ {
g_warning ("XShmCreateImage failed"); g_warning ("XShmCreateImage failed");
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
} }
...@@ -210,8 +211,8 @@ gdk_image_new (GdkImageType type, ...@@ -210,8 +211,8 @@ gdk_image_new (GdkImageType type,
g_warning ("shmget failed!"); g_warning ("shmget failed!");
XDestroyImage (private->ximage); XDestroyImage (private->ximage);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
...@@ -228,8 +229,8 @@ gdk_image_new (GdkImageType type, ...@@ -228,8 +229,8 @@ gdk_image_new (GdkImageType type,
XDestroyImage (private->ximage); XDestroyImage (private->ximage);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
return NULL; return NULL;
} }
...@@ -253,8 +254,8 @@ gdk_image_new (GdkImageType type, ...@@ -253,8 +254,8 @@ gdk_image_new (GdkImageType type,
shmdt (x_shm_info->shmaddr); shmdt (x_shm_info->shmaddr);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
...@@ -265,12 +266,12 @@ gdk_image_new (GdkImageType type, ...@@ -265,12 +266,12 @@ gdk_image_new (GdkImageType type,
} }
else else
{ {
free (image); g_free (image);
return NULL; return NULL;
} }
break; break;
#else /* USE_SHM */ #else /* USE_SHM */
free (image); g_free (image);
return NULL; return NULL;
#endif /* USE_SHM */ #endif /* USE_SHM */
case GDK_IMAGE_NORMAL: case GDK_IMAGE_NORMAL:
...@@ -279,7 +280,11 @@ gdk_image_new (GdkImageType type, ...@@ -279,7 +280,11 @@ gdk_image_new (GdkImageType type,
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth, private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
ZPixmap, 0, 0, width, height, 32, 0); ZPixmap, 0, 0, width, height, 32, 0);
private->ximage->data = malloc (sizeof (char) * private->ximage->bytes_per_line * private->ximage->height); /* Use malloc, not g_malloc here, because X will call free()
* on this data
*/
private->ximage->data = malloc (private->ximage->bytes_per_line *
private->ximage->height);
break; break;
case GDK_IMAGE_FASTEST: case GDK_IMAGE_FASTEST:
...@@ -330,7 +335,7 @@ gdk_image_get (GdkWindow *window, ...@@ -330,7 +335,7 @@ gdk_image_get (GdkWindow *window,
if (win_private->destroyed) if (win_private->destroyed)
return NULL; return NULL;
private = malloc (sizeof (GdkImagePrivate)); private = g_new (GdkImagePrivate, 1);
image = (GdkImage*) private; image = (GdkImage*) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
...@@ -411,7 +416,7 @@ gdk_image_destroy (GdkImage *image) ...@@ -411,7 +416,7 @@ gdk_image_destroy (GdkImage *image)
shmdt (x_shm_info->shmaddr); shmdt (x_shm_info->shmaddr);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
image_list = g_list_remove (image_list, image); image_list = g_list_remove (image_list, image);
#else /* USE_SHM */ #else /* USE_SHM */
...@@ -423,7 +428,7 @@ gdk_image_destroy (GdkImage *image) ...@@ -423,7 +428,7 @@ gdk_image_destroy (GdkImage *image)
g_assert_not_reached (); g_assert_not_reached ();
} }
free (image); g_free (image);
} }
static void static void
......
...@@ -591,10 +591,9 @@ gdk_input_gxi_grab_pointer (GdkWindow * window, ...@@ -591,10 +591,9 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
GdkWindow * confine_to, GdkWindow * confine_to,
guint32 time) guint32 time)
{ {
GdkInputWindow *input_window, *new_window;
GList *tmp_list; GList *tmp_list;
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev; GdkDevicePrivate *gdkdev;
GList *tmp_list;
tmp_list = gdk_input_windows; tmp_list = gdk_input_windows;
while (tmp_list) while (tmp_list)
...@@ -602,27 +601,25 @@ gdk_input_gxi_grab_pointer (GdkWindow * window, ...@@ -602,27 +601,25 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
input_window = (GdkInputWindow *)tmp_list->data; input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->window == window) if (input_window->window == window)
new_window = input_window; input_window->grabbed = TRUE;
else (input_window->grabbed) else if (input_window->grabbed)
input_window->grabbed = FALSE; input_window->grabbed = FALSE;
tmp_list = gdk_input_devices; tmp_list = tmp_list->next;
while (tmp_list) }
{
gdkdev = (GdkDevicePrivate *)tmp_list->data; tmp_list = gdk_input_devices;
if (gdkdev->info.deviceid != GDK_CORE_POINTER && while (tmp_list)
gdkdev->xdevice && {
(gdkdev->button_state != 0)) gdkdev = (GdkDevicePrivate *)tmp_list->data;
gdkdev->button_state = 0; if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice &&
tmp_list = tmp_list->next; (gdkdev->button_state != 0))
} gdkdev->button_state = 0;
tmp_list = tmp_list->next; tmp_list = tmp_list->next;
} }
new_window->grabbed = TRUE;
return Success; return Success;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#define ENABLE_GRAYSCALE #define ENABLE_GRAYSCALE
...@@ -628,8 +629,9 @@ gdk_rgb_init (void) ...@@ -628,8 +629,9 @@ gdk_rgb_init (void)
for (i = 0; i < N_IMAGES; i++) for (i = 0; i < N_IMAGES; i++)
if (image_info->bitmap) if (image_info->bitmap)
/* Use malloc() instead of g_malloc since X will free() this mem */
static_image[i] = gdk_image_new_bitmap (image_info->visual, static_image[i] = gdk_image_new_bitmap (image_info->visual,
g_malloc (IMAGE_WIDTH * IMAGE_HEIGHT >> 3), malloc (IMAGE_WIDTH * IMAGE_HEIGHT >> 3),
IMAGE_WIDTH, IMAGE_HEIGHT); IMAGE_WIDTH, IMAGE_HEIGHT);
else else
static_image[i] = gdk_image_new (GDK_IMAGE_FASTEST, static_image[i] = gdk_image_new (GDK_IMAGE_FASTEST,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "../config.h" #include "../config.h"
#include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H) #if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
...@@ -84,7 +85,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h) ...@@ -84,7 +85,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
Visual *xvisual; Visual *xvisual;
GdkImage *image; GdkImage *image;
GdkImagePrivate *private; GdkImagePrivate *private;
private = malloc (sizeof (GdkImagePrivate)); private = g_new(GdkImagePrivate, 1);
image = (GdkImage *) private; image = (GdkImage *) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
private->image_put = gdk_image_put_normal; private->image_put = gdk_image_put_normal;
...@@ -165,7 +166,7 @@ gdk_image_new (GdkImageType type, ...@@ -165,7 +166,7 @@ gdk_image_new (GdkImageType type,
break; break;
default: default:
private = malloc (sizeof (GdkImagePrivate)); private = g_new (GdkImagePrivate, 1);
image = (GdkImage*) private; image = (GdkImage*) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
...@@ -187,7 +188,7 @@ gdk_image_new (GdkImageType type, ...@@ -187,7 +188,7 @@ gdk_image_new (GdkImageType type,
{ {
private->image_put = gdk_image_put_shared; private->image_put = gdk_image_put_shared;
private->x_shm_info = malloc (sizeof (XShmSegmentInfo)); private->x_shm_info = g_new (XShmSegmentInfo, 1);
x_shm_info = private->x_shm_info; x_shm_info = private->x_shm_info;
private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth, private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth,
...@@ -196,7 +197,7 @@ gdk_image_new (GdkImageType type, ...@@ -196,7 +197,7 @@ gdk_image_new (GdkImageType type,
{ {
g_warning ("XShmCreateImage failed"); g_warning ("XShmCreateImage failed");
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
} }
...@@ -210,8 +211,8 @@ gdk_image_new (GdkImageType type, ...@@ -210,8 +211,8 @@ gdk_image_new (GdkImageType type,
g_warning ("shmget failed!"); g_warning ("shmget failed!");
XDestroyImage (private->ximage); XDestroyImage (private->ximage);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
...@@ -228,8 +229,8 @@ gdk_image_new (GdkImageType type, ...@@ -228,8 +229,8 @@ gdk_image_new (GdkImageType type,
XDestroyImage (private->ximage); XDestroyImage (private->ximage);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
return NULL; return NULL;
} }
...@@ -253,8 +254,8 @@ gdk_image_new (GdkImageType type, ...@@ -253,8 +254,8 @@ gdk_image_new (GdkImageType type,
shmdt (x_shm_info->shmaddr); shmdt (x_shm_info->shmaddr);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
free (image); g_free (image);
gdk_use_xshm = False; gdk_use_xshm = False;
return NULL; return NULL;
...@@ -265,12 +266,12 @@ gdk_image_new (GdkImageType type, ...@@ -265,12 +266,12 @@ gdk_image_new (GdkImageType type,
} }
else else
{ {
free (image); g_free (image);
return NULL; return NULL;
} }
break; break;
#else /* USE_SHM */ #else /* USE_SHM */
free (image); g_free (image);
return NULL; return NULL;
#endif /* USE_SHM */ #endif /* USE_SHM */
case GDK_IMAGE_NORMAL: case GDK_IMAGE_NORMAL:
...@@ -279,7 +280,11 @@ gdk_image_new (GdkImageType type, ...@@ -279,7 +280,11 @@ gdk_image_new (GdkImageType type,
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth, private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
ZPixmap, 0, 0, width, height, 32, 0); ZPixmap, 0, 0, width, height, 32, 0);
private->ximage->data = malloc (sizeof (char) * private->ximage->bytes_per_line * private->ximage->height); /* Use malloc, not g_malloc here, because X will call free()
* on this data
*/
private->ximage->data = malloc (private->ximage->bytes_per_line *
private->ximage->height);
break; break;
case GDK_IMAGE_FASTEST: case GDK_IMAGE_FASTEST:
...@@ -330,7 +335,7 @@ gdk_image_get (GdkWindow *window, ...@@ -330,7 +335,7 @@ gdk_image_get (GdkWindow *window,
if (win_private->destroyed) if (win_private->destroyed)
return NULL; return NULL;
private = malloc (sizeof (GdkImagePrivate)); private = g_new (GdkImagePrivate, 1);
image = (GdkImage*) private; image = (GdkImage*) private;
private->xdisplay = gdk_display; private->xdisplay = gdk_display;
...@@ -411,7 +416,7 @@ gdk_image_destroy (GdkImage *image) ...@@ -411,7 +416,7 @@ gdk_image_destroy (GdkImage *image)
shmdt (x_shm_info->shmaddr); shmdt (x_shm_info->shmaddr);
shmctl (x_shm_info->shmid, IPC_RMID, 0); shmctl (x_shm_info->shmid, IPC_RMID, 0);
free (private->x_shm_info); g_free (private->x_shm_info);
image_list = g_list_remove (image_list, image); image_list = g_list_remove (image_list, image);
#else /* USE_SHM */ #else /* USE_SHM */
...@@ -423,7 +428,7 @@ gdk_image_destroy (GdkImage *image) ...@@ -423,7 +428,7 @@ gdk_image_destroy (GdkImage *image)
g_assert_not_reached (); g_assert_not_reached ();