Menu

#2202 Setting -sashwidth to 0 makes wish abort on X11

obsolete: 8.5a5
open
5
2008-06-26
2007-01-19
Anonymous
No

In X11, setting the -sashwidth option of panedwindow to 0 makes
wish abort with a bad X request when Tk try to create a proxy window.
Apparently in X is invalid to create a window of width 0.

emiliano@erizo:~$ wish8.4
% pack [panedwindow .pw -sashwidth 0]
% .pw add [label .l1 -text Hello]
% .pw add [label .l2 -text world]
%

and after resizing the pane I get:

X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0x0
Serial number of failed request: 232
Current serial number in output stream: 234
emiliano@erizo:~$

The same problem occurs if the proxy window is created by the script:

emiliano@erizo:~$ wish8.4
% pack [panedwindow .pw -sashwidth 0]
% .pw add [label .l1 -text Hello]
% .pw add [label .l2 -text world]
% .pw proxy place 0 0
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0x0
Serial number of failed request: 152
Current serial number in output stream: 154
emiliano@erizo:~$

Discussion

  • Emiliano

    Emiliano - 2008-05-13

    Logged In: YES
    user_id=1852298
    Originator: NO

    I'm the original poster. The bug is still present in 8.5.2
    After some source dive I come up with this patch that restrict
    the size of the proxy window to 1 pixel and above.
    This effectively workarounds the problem.

    --- generic/tkPanedWindow.c.orig 2008-05-13 19:52:10.000000000 -0300
    +++ generic/tkPanedWindow.c 2008-05-13 20:04:08.000000000 -0300
    @@ -2818,7 +2818,17 @@
    x = 0;
    }
    y = Tk_InternalBorderWidth(pwPtr->tkwin);
    - sashWidth = pwPtr->sashWidth;
    +
    + /* If the sashwidth is less than 1, use 1 as the width of the
    + proxy window. This workarounds bug #1639824
    + */
    +
    + if (pwPtr->sashWidth > 0) {
    + sashWidth = pwPtr->sashWidth;
    + } else {
    + sashWidth = 1;
    + }
    +
    sashHeight = Tk_Height(pwPtr->tkwin) -
    (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
    } else {
    @@ -2826,7 +2836,13 @@
    y = 0;
    }
    x = Tk_InternalBorderWidth(pwPtr->tkwin);
    - sashHeight = pwPtr->sashWidth;
    +
    + if (pwPtr->sashWidth > 0) {
    + sashHeight = pwPtr->sashWidth;
    + } else {
    + sashHeight = 1;
    + }
    +
    sashWidth = Tk_Width(pwPtr->tkwin) -
    (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
    }

     
  • Donal K. Fellows

    • assigned_to: hobbs --> dgp
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902
    Originator: NO

    A fix is applied to the HEAD; needs someone to backport to earlier branches: 8.5, 8.4 only if there's going to be another release in that series. Handing off to release manager for decisions on that front.

     
  • Don Porter

    Don Porter - 2008-05-14
    • priority: 5 --> 8
     
  • Don Porter

    Don Porter - 2008-06-19
    • priority: 8 --> 9
     
  • Don Porter

    Don Porter - 2008-06-19

    Logged In: YES
    user_id=80530
    Originator: NO

    must backport before 8.5.3 or 8.4.20

     
  • Don Porter

    Don Porter - 2008-06-26

    Logged In: YES
    user_id=80530
    Originator: NO

    Backported for 8.5.3.

    Existing patch is ineffective
    as a fix for the bugs in Tk 8.4.19,
    so that's left untouched unless/until
    a patch that works on that branch
    is contributed.

     
  • Don Porter

    Don Porter - 2008-06-26
    • priority: 9 --> 5
    • assigned_to: dgp --> hobbs