Tk Source Code

View Ticket
Login
Ticket UUID: 2264732
Title: ttk themed widget X11 visual crash & patch
Type: Bug Version: None
Submitter: cjmcdonald Created on: 2008-11-11 21:20:35
Subsystem: 88. Themed Tk Assigned To: jenglish
Priority: 8 Severity:
Status: Closed Last Modified: 2008-12-23 01:15:17
Resolution: Fixed Closed By: jenglish
    Closed on: 2008-12-22 18:15:17
Description:
Using ttk widgets in a wish toplevel which has
a different X11 visual to the screen root window
crashes.

E.g. on a system with a 24-bit truecolor root
window, which also supports 8-bit pseudocolor:

% wish8.5 -visual "pseudocolor 8"
  ttk::label .l -text test
  pack .l

crashes with:

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 70 (X_PolyFillRectangle)
Serial number of failed request: 82
Current serial number in output stream: 83

The problem is in the double buffering code in
ttkWidget.c,routine BeginDrawing(). It creates
a pixmap with depth:

DefaultDepthOfScreen(Tk_Screen(tkwin))

which should simply be replaced with

Tk_Depth(tkwin)

An updated ttkWidget.c from CVS head revision 1.16
is attached.  The same fix can be applied to the
8.5.* series.

Searching the bug tracker, this appears to be
identical to the tk panedwindow bug #671122
in 2003.
User Comments: jenglish added on 2008-12-23 01:15:17:
This one's easy enough.   Backported.

Missed the tag date though.

dgp added on 2008-12-22 03:29:24:
backport for 8.5.6 ?

jenglish added on 2008-11-12 06:39:48:
Patch committed; thanks.

Please note that the ttk widgets will still not support multiple visuals within an application, e.g., with [toplevel .t -visual $some_other_visual] any ttk::* widgets created under .t will not display properly, and will probably lead to a hard X error.

cjmcdonald added on 2008-11-12 04:20:35:

File Added - 301034: ttkWidget.c

Attachments: