summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-04-12 10:03:02 (GMT)
committerhobbs <hobbs>2002-04-12 10:03:02 (GMT)
commit5d979f7986281109d4edaa513c46e0178e994e76 (patch)
tree5af76093a740c78301ef4e4d70653892f48e8f6e
parent43904a65805af063144dea03a7da86f9e626d187 (diff)
downloadtk-5d979f7986281109d4edaa513c46e0178e994e76.zip
tk-5d979f7986281109d4edaa513c46e0178e994e76.tar.gz
tk-5d979f7986281109d4edaa513c46e0178e994e76.tar.bz2
generic/tkClipboard.c (TkClipCleanup): frees TkDisplay data
-rw-r--r--generic/tkClipboard.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 9558d0c..149f65d 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkClipboard.c,v 1.8 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkClipboard.c,v 1.9 2002/04/12 10:03:02 hobbs Exp $
*/
#include "tkInt.h"
@@ -623,6 +623,44 @@ Tk_ClipboardObjCmd(clientData, interp, objc, objv)
/*
*----------------------------------------------------------------------
*
+ * TkClipCleanup --
+ *
+ * This procedure is called to cleanup resources associated with
+ * claiming clipboard ownership and for receiving selection get
+ * results. This function is called in tkWindow.c. This has to be
+ * called by the display cleanup function because we still need the
+ * access display elements.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Resources are freed - the clipboard may no longer be used.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkClipCleanup(dispPtr)
+ TkDisplay *dispPtr; /* display associated with clipboard */
+{
+ if (dispPtr->clipWindow != NULL) {
+ Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
+ dispPtr->applicationAtom);
+ Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
+ dispPtr->windowAtom);
+ /*
+ * It may be too late to call Tk_DestroyWindow, so just free the
+ * memory created directly.
+ */
+ ckfree((char *) dispPtr->clipWindow);
+ dispPtr->clipWindow = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkClipInit --
*
* This procedure is called to initialize the window for claiming