summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--unix/tkUnixButton.c22
-rw-r--r--unix/tkUnixMenu.c9
3 files changed, 24 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a8956d..fb7a9f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2003-08-14 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+ * unix/tkUnixButton.c (TkpDisplayButton): Stopped accesses to NULL
+ * unix/tkUnixMenu.c (TkpDrawMenuEntry): pointers that crashed tests.
+
TIP #109 IMPLEMENTATION FROM Brian Griffin <bgriffin@model.com>
* unix/tkUnixButton.c (TkpDrawCheckIndicator, TkpDisplayButton):
* unix/tkUnixMenu.c (DrawMenuEntryIndicator, TkpDrawMenuEntry):
diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c
index 4fb3b9e..e4f7fe7 100644
--- a/unix/tkUnixButton.c
+++ b/unix/tkUnixButton.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixButton.c,v 1.14 2003/08/14 10:31:14 dkf Exp $
+ * RCS: @(#) $Id: tkUnixButton.c,v 1.15 2003/08/14 12:30:11 dkf Exp $
*/
#include "tkButton.h"
@@ -599,23 +599,31 @@ TkpDisplayButton(clientData)
if ((butPtr->type == TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
+ }
x -= butPtr->indicatorSpace/2;
y = Tk_Height(tkwin)/2;
- TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap,
- x, y, border, butPtr->normalFg, selBorder->bgColorPtr,
- butPtr->disabledFg, (butPtr->flags & SELECTED),
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ (butPtr->flags & SELECTED),
(butPtr->state == STATE_DISABLED), CHECK_BUTTON);
}
} else if ((butPtr->type == TYPE_RADIO_BUTTON) && butPtr->indicatorOn) {
if (butPtr->indicatorDiameter > 2*butPtr->borderWidth) {
TkBorder *selBorder = (TkBorder *) butPtr->selectBorder;
+ XColor *selColor = NULL;
+ if (selBorder != NULL) {
+ selColor = selBorder->bgColorPtr;
+ }
x -= butPtr->indicatorSpace/2;
y = Tk_Height(tkwin)/2;
- TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap,
- x, y, border, butPtr->normalFg, selBorder->bgColorPtr,
- butPtr->disabledFg, (butPtr->flags & SELECTED),
+ TkpDrawCheckIndicator(tkwin, butPtr->display, pixmap, x, y,
+ border, butPtr->normalFg, selColor, butPtr->disabledFg,
+ (butPtr->flags & SELECTED),
(butPtr->state == STATE_DISABLED), RADIO_BUTTON);
}
}
diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c
index 302edaf..1e6a682 100644
--- a/unix/tkUnixMenu.c
+++ b/unix/tkUnixMenu.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixMenu.c,v 1.8 2003/08/14 10:31:14 dkf Exp $
+ * RCS: @(#) $Id: tkUnixMenu.c,v 1.9 2003/08/14 12:30:11 dkf Exp $
*/
#include "tkPort.h"
@@ -1346,7 +1346,7 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
{
GC gc, indicatorGC;
XColor *indicatorColor;
- XColor *disableColor;
+ XColor *disableColor = NULL;
TkMenu *menuPtr = mePtr->menuPtr;
Tk_3DBorder bgBorder, activeBorder;
CONST Tk_FontMetrics *fmPtr;
@@ -1409,7 +1409,10 @@ TkpDrawMenuEntry(mePtr, d, tkfont, menuMetricsPtr, x, y, width, height,
menuPtr->indicatorFgPtr);
}
- disableColor = Tk_GetColorFromObj(menuPtr->tkwin, menuPtr->disabledFgPtr);
+ if (menuPtr->disabledFgPtr != NULL) {
+ disableColor = Tk_GetColorFromObj(menuPtr->tkwin,
+ menuPtr->disabledFgPtr);
+ }
bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
(mePtr->borderPtr == NULL)