diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 730de5d8d..ecb62fa17 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -95,7 +95,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state) /* * Ttk_StyleDefault -- - * Look up default resource setting the in the specified style. + * Look up default resource setting in the specified style. */ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) { @@ -216,7 +216,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) * from the specified element specification. */ static Ttk_ElementClass * -NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) +NewElementClass(const char *name, Ttk_ElementSpec *specPtr, void *clientData) { Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass)); int i; @@ -237,7 +237,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) elementClass->defaultValues = (Tcl_Obj **) ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { - const char *defaultValue = specPtr->options[i].defaultValue; + const char *defaultValue = specPtr->options[i].defaultValue; if (defaultValue) { elementClass->defaultValues[i] = Tcl_NewStringObj(defaultValue,-1); Tcl_IncrRefCount(elementClass->defaultValues[i]); @@ -407,7 +407,7 @@ typedef struct * Cleanup procedure for StylePackageData. */ static void Ttk_StylePkgFree( - ClientData clientData, + void *clientData, TCL_UNUSED(Tcl_Interp *)) { StylePackageData *pkgPtr = (StylePackageData *)clientData; @@ -475,7 +475,7 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) * */ void Ttk_RegisterCleanup( - Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) + Tcl_Interp *interp, void *clientData, Ttk_CleanupProc *cleanupProc) { StylePackageData *pkgPtr = GetStylePackageData(interp); Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); @@ -498,7 +498,7 @@ void Ttk_RegisterCleanup( * the widget hierarchy, so this is done by evaluating a Tcl script. */ -static void ThemeChangedProc(ClientData clientData) +static void ThemeChangedProc(void *clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; StylePackageData *pkgPtr = (StylePackageData *)clientData; @@ -534,9 +534,10 @@ void Ttk_TkDestroyedHandler( StylePackageData* pkgPtr = GetStylePackageData(interp); /* - * Cancel any pending ThemeChanged calls: + * Cancel any pending ThemeChanged calls. We might be called + * before Ttk is initialized. See bug [3981091ed336]. */ - if (pkgPtr->themeChangePending) { + if (pkgPtr && pkgPtr->themeChangePending) { Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr); } } @@ -1188,7 +1189,7 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) */ static int StyleMapCmd( - ClientData clientData, /* StylePackageData pointer */ + void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -1255,7 +1256,7 @@ StyleMapCmd( /* + style configure $style -option ?value... */ static int StyleConfigureCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1272,10 +1273,10 @@ static int StyleConfigureCmd( styleName = Tcl_GetString(objv[2]); stylePtr = Ttk_GetStyle(theme, styleName); - if (objc == 3) { /* style default $styleName */ + if (objc == 3) { /* style configure $styleName */ Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable)); return TCL_OK; - } else if (objc == 4) { /* style default $styleName -option */ + } else if (objc == 4) { /* style configure $styleName -option */ const char *optionName = Tcl_GetString(objv[3]); Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName); @@ -1310,7 +1311,7 @@ static int StyleConfigureCmd( /* + style lookup $style -option ?statespec? ?defaultValue? */ static int StyleLookupCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1352,7 +1353,7 @@ static int StyleLookupCmd( } static int StyleThemeCurrentCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; @@ -1388,7 +1389,7 @@ static int StyleThemeCurrentCmd( /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *const optStrings[] = @@ -1452,10 +1453,10 @@ static int StyleThemeCreateCmd( * Return list of registered themes. */ static int StyleThemeNamesCmd( - ClientData clientData, + void *clientData, Tcl_Interp *interp, - TCL_UNUSED(int), - TCL_UNUSED(Tcl_Obj *const *)) + TCL_UNUSED(int), /* objc */ + TCL_UNUSED(Tcl_Obj *const *)) /* objv */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; @@ -1469,7 +1470,7 @@ static int StyleThemeNamesCmd( */ static int StyleThemeSettingsCmd( - ClientData clientData, /* StylePackageData pointer */ + void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -1498,7 +1499,7 @@ StyleThemeSettingsCmd( /* + style element create name type ? ...args ? */ static int StyleElementCreateCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1533,7 +1534,7 @@ static int StyleElementCreateCmd( * Return a list of elements defined in the current theme. */ static int StyleElementNamesCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1549,7 +1550,7 @@ static int StyleElementNamesCmd( * Return list of element options for specified element */ static int StyleElementOptionsCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1587,7 +1588,7 @@ static int StyleElementOptionsCmd( /* + style layout name ?spec? */ static int StyleLayoutCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1627,7 +1628,7 @@ static int StyleLayoutCmd( */ static int StyleThemeUseCmd( - ClientData clientData, /* StylePackageData pointer */ + void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -1684,7 +1685,7 @@ static const Ttk_Ensemble StyleEnsemble[] = { static int StyleObjCmd( - ClientData clientData, /* StylePackageData pointer */ + void *clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */