/*
 * -- $Header: /cec/src/nestor/servers/R3/shXlib/XFreePix.c,v 1.1.1.1
 * 90/04/23 09:58:00 spanachi Exp $
 */

#include "copyright.h"

/* $XConsortium: XFreePix.c,v 11.6 88/09/06 16:07:34 jim Exp $ */
/* Copyright    Massachusetts Institute of Technology    1986	 */

/* MULTIPLEX Extension -- */

#include "Xlibint.h"

/* -- additional includes -- */
#include "resources.h"

XFreePixmap (dpy, pixmap)
  register Display *dpy;
  Pixmap pixmap;

{
  register xResourceReq *req;

  /*
   * -- One more time : "Dangling resource references" ! -- What about a
   * bitmap that is used to create a cursor and is freed -- then ? There's no
   * way (apart from storing the bitmap contents -- ( in main memory or in a
   * bitmap file)! ) to recreate this bitmap -- So, if it is still
   * referenced, do not free it !
   */
  if (XmuXBmapStillReferenced (dpy, pixmap))
    return;

  LockDisplay (dpy);
  GetResReq (FreePixmap, pixmap, req);

  /* -- remove the resource info if necessary -- */
  if (XmuXStoreResources (dpy))
    XmuXRemovePixmapInfo (dpy, pixmap);

  UnlockDisplay (dpy);
  SyncHandle ();
}
