| 1 |
# Copyright (c) 1990 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk_FreeXId - make X resource identifier available for reuse |
| 11 |
|
| 12 |
=for category C Programming |
| 13 |
|
| 14 |
=head1 SYNOPSIS |
| 15 |
|
| 16 |
B<#include E<lt>tk.hE<gt>> |
| 17 |
|
| 18 |
B<Tk_FreeXId(>I<display, id>B<)> |
| 19 |
|
| 20 |
=head1 ARGUMENTS |
| 21 |
|
| 22 |
=over 4 |
| 23 |
|
| 24 |
=item Display *display (in) |
| 25 |
|
| 26 |
Display for which I<id> was allocated. |
| 27 |
|
| 28 |
=item XID id (in) |
| 29 |
|
| 30 |
Identifier of X resource (window, font, pixmap, cursor, graphics |
| 31 |
context, or colormap) that is no longer in use. |
| 32 |
|
| 33 |
=back |
| 34 |
|
| 35 |
=head1 DESCRIPTION |
| 36 |
|
| 37 |
The default allocator for resource identifiers provided by Xlib is very |
| 38 |
simple-minded and does not allow resource identifiers to be re-used. |
| 39 |
If a long-running application reaches the end of the resource id |
| 40 |
space, it will generate an X protocol error and crash. |
| 41 |
Tk replaces the default id allocator with its own allocator, which |
| 42 |
allows identifiers to be reused. |
| 43 |
In order for this to work, B<Tk_FreeXId> must be called to |
| 44 |
tell the allocator about resources that have been freed. |
| 45 |
Tk automatically calls B<Tk_FreeXId> whenever it frees a |
| 46 |
resource, so if you use procedures like B<Tk_GetFontStruct>, |
| 47 |
B<Tk_GetGC>, and B<Tk_GetPixmap> then you need not call |
| 48 |
B<Tk_FreeXId>. |
| 49 |
However, if you allocate resources directly from Xlib, for example |
| 50 |
by calling B<XCreatePixmap>, then you should call B<Tk_FreeXId> |
| 51 |
when you call the corresponding Xlib free procedure, such as |
| 52 |
B<XFreePixmap>. |
| 53 |
If you don't call B<Tk_FreeXId> then the resource identifier will |
| 54 |
be lost, which could cause problems if the application runs long enough |
| 55 |
to lose all of the available identifiers. |
| 56 |
|
| 57 |
=head1 KEYWORDS |
| 58 |
|
| 59 |
resource identifier |