Version 1 of Tk crash with Linux/Intel

Updated 2014-09-03 20:25:00 by idg

I have been experiencing strange crashes running Tk on Linux (OpenSuse 13.1) on my i5-2500K. In some respect this must be a video driver problem, since if I replace the intel driver with the (very slow) framebuffer driver, the crash does not occur.

However, there is a dependence on what you are doing in Tk. Drawing lines on a canvas causes a crash of X iff _all_ of the following conditions are met:

 1. lines extend outside visible area of canvas
 2. lines are smoothed
 3. lines are dashed
 4. lines are 1 pixel wide

There's a litle test program below. I'd be interested if it crashes for anyone else's i5-2500K, or if something is peculiar about mine.

As it stands, this program does not crash. If I edit the canvas dimensions to 400x400 it does. If I change the comments to enable one of the alternative canvas create statements it does not crash, even on the smaller canvas.

Does anyone understand what's really going on?

----------------------------- cut here ------------------------------- #! /usr/bin/env tclsh

# WARNING THIS WILL DESTROY ANY FILE NAMED crash_count

package require Tk

set pts {512 88 473 49 346 112 229 229 112 346 49 473\

         88 512 127 551 254 488 371 371 488 254 551 127}

proc main {} {

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

   file delete crash_count
   set c 0
   for {set i 0} {$i < 1000} {incr i} {
      set cc [format "#%03x" [expr {$c % 4096}]]
     .c create line $::pts -fill $cc -smooth raw -splinesteps 99 -dash {3 3}

# .c create line $::pts -fill $cc -width 2 -smooth raw -splinesteps 99 -dash {3 3} # .c create line $::pts -fill $cc -smooth raw -splinesteps 99 # .c create line $::pts -fill $cc -dash {3 3}

      update idletasks
      incr c
      set f [open crash_count w]
      puts $f $c
      close $f
   }
   puts done

}

main