 Tk crashes when drawing multi-segment dashed lines that extend
 outside the visible area of the canvas. This crash is observed
 running Linux (opensuse 13.1) on intel i5-2500k with on-chip
 graphics. The crash occurs with both KDE and icewm. The actual
 crash is termination of the X server with a segfault.

 The crash does not occur if the default intel video driver is
 replaced by the (slow) fbdev driver. This suggests a bug in the
 driver, but
 a) No other program has ever caused a similar crash on this computer
 b) The crash can be prevented by seemingly trivial changes in the Tk code.

 The crash can be generated by the script below. It does not occur
 every time a line is drawn, hence the loop. After a crash, the file
 crash_count indicates how many times the loop ran successfully.
 Typically less than 100 loop iterations are required for a crash.

 If _any_ of the following modifications are made to this script, no
 crashes occur:
 a) Change canvas dimensions to 600 x 600
 b) Change -dash value to {}
 c) Change -width value to 2
 d) Lines with < 20 segments don't crash (not exhaustively tested)

 ------------------------------- Cut here -----------------------------
 #! tclsh

 # WARNING THIS WILL DESTROY ANY FILE NAMED crash_count

 package require Tk

 set pts {
    229 229 223 234 217 240 211 246 205 252 200 258 195 264 189 270 184
    276 179 282 174 288 169 294 164 300 160 306 155 312 151 318 146 324
    142 330 138 336 134 341 130 347 126 353 123 358 119 364 116 370 113
    375 109 381 106 386 104 391 101 397 98 402 96 407 93 412 91 417 89
    422 87 427 86 432 84 436 82 441 81 445 80 450 79 454 78 458 77 462
    77 466 76 470 76 474 76 478 76 481 76 485 77 488 77 491 78 494 79
    497 80 500 81 502 82 505 84 507 86 509 88 512
 }

 proc main {} {
    global pts
    puts "tcl version: [info patch]"
    flush stdout

    canvas .c -width 400 -height 400 -bg white
    pack .c -fill both -expand 1

    file delete crash_count

    set N 5000
    for {set i 0} {$i < $N} {incr i} {

      .c create line $pts -fill blue -dash {3 3} -width 1

       update idletasks
       set f [open crash_count w]
       puts $f $i
       close $f
       .c delete all
    }
    puts "done $N cycles"
 }

 main