summaryrefslogtreecommitdiffstats
path: root/generic/ttk
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2006-11-12 20:35:38 (GMT)
committerjenglish <jenglish@flightlab.com>2006-11-12 20:35:38 (GMT)
commitde4c02e6bf791d2a84db56fe77ff5dddfdefe6b1 (patch)
tree0bf3609ab8b575b21413b96e7c7961769694c9ce /generic/ttk
parentc8fd8c3b3b073f1e7e3ff81ea864d8b3060fa386 (diff)
downloadtk-de4c02e6bf791d2a84db56fe77ff5dddfdefe6b1.zip
tk-de4c02e6bf791d2a84db56fe77ff5dddfdefe6b1.tar.gz
tk-de4c02e6bf791d2a84db56fe77ff5dddfdefe6b1.tar.bz2
Reworked cleanup procedure -- "self-cancelling" idle call is not robust,
call Tcl_CancelIdleCall() in TtkFreeScrollHandle instead. [fixes #1588251]
Diffstat (limited to 'generic/ttk')
-rw-r--r--generic/ttk/ttkScroll.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index cc40a66..41173a6a 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -1,4 +1,4 @@
-/* $Id: ttkScroll.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkScroll.c,v 1.3 2006/11/12 20:35:38 jenglish Exp $
*
* Copyright 2004, Joe English
*
@@ -68,11 +68,6 @@ ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr)
return h;
}
-void TtkFreeScrollHandle(ScrollHandle h)
-{
- Tcl_EventuallyFree((ClientData)h, TCL_DYNAMIC);
-}
-
/* UpdateScrollbar --
* Call the -scrollcommand callback to sync the scrollbar.
* Returns: Whatever the -scrollcommand does.
@@ -83,7 +78,7 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h)
char args[TCL_DOUBLE_SPACE * 2];
int code;
- h->flags &= ~(SCROLL_UPDATE_PENDING | SCROLL_UPDATE_REQUIRED);
+ h->flags &= ~SCROLL_UPDATE_REQUIRED;
if (s->scrollCmd == NULL)
return TCL_OK;
@@ -100,7 +95,7 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h)
}
Tcl_Release(h->corePtr);
- if (code != TCL_OK) {
+ if (code != TCL_OK && !Tcl_InterpDeleted(interp)) {
/* Disable the -scrollcommand, add to stack trace:
*/
ckfree(s->scrollCmd);
@@ -123,18 +118,13 @@ static void UpdateScrollbarBG(ClientData clientData)
Tcl_Interp *interp = h->corePtr->interp;
int code;
- if (WidgetDestroyed(h->corePtr)) {
- Tcl_Release(clientData);
- return;
- }
-
+ h->flags &= ~SCROLL_UPDATE_PENDING;
Tcl_Preserve((ClientData) interp);
code = UpdateScrollbar(interp, h);
if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) {
Tcl_BackgroundError(interp);
}
Tcl_Release((ClientData) interp);
- Tcl_Release(clientData);
}
/* TtkScrolled --
@@ -160,7 +150,6 @@ void TtkScrolled(ScrollHandle h, int first, int last, int total)
s->total = total;
if (!(h->flags & SCROLL_UPDATE_PENDING)) {
- Tcl_Preserve((ClientData)h);
Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h);
h->flags |= SCROLL_UPDATE_PENDING;
}
@@ -246,3 +235,11 @@ void TtkScrollTo(ScrollHandle h, int newFirst)
}
}
+void TtkFreeScrollHandle(ScrollHandle h)
+{
+ if (h->flags & SCROLL_UPDATE_PENDING) {
+ Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
+ }
+ Tcl_Free((ClientData)h);
+}
+