undefined method `yscrollcommand' for nil:NilClass (NoMethodError)

Bug #511339 reported by Siep Kroonenberg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ruby1.9 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: ruby1.9

Ubuntu release: Karmic
Package version: 1.9.0.5-1ubuntu

I expected the Ruby/Tk test script at the end to run the same as under Ruby1.8 and Ruby1.9.1. Instead, it came back with the message:

ruby1.9 ./crash19a.rb
./crash19a.rb:12:in `block (3 levels) in <main>': undefined method `yscrollcommand' for nil:NilClass (NoMethodError)
 from ./crash19a.rb:9:in `new'
 from ./crash19a.rb:9:in `block (2 levels) in <main>'
 from /usr/lib/ruby/1.9.0/tk/text.rb:262:in `instance_eval'
 from /usr/lib/ruby/1.9.0/tk/text.rb:262:in `new'
 from ./crash19a.rb:8:in `block in <main>'
 from ./crash19a.rb:7:in `new'
 from ./crash19a.rb:7:in `<main>'

This is the test script:

#!/usr/bin/ruby

require 'tk'

root = TkRoot.new()

t = TkToplevel.new( root ) { |tl|
  TkText.new( tl ) { |tx|
    TkScrollbar.new( tl ) { |s|
      pack( 'side' => 'right', 'fill' => 'y' )
      command proc{ |*args| t.yview(*args) }
      tx.yscrollcommand proc{ |first, last| s.set first, last }
    }
    pack( 'expand'=>'yes', 'fill'=>'both' )
    insert( '0.0', "This window is a text widget." )
  }
  TkButton.new( tl ) {
    text 'Leave'
    command proc{ tl.withdraw; root.focus }
    pack
  }
  withdraw
}

TkButton.new( root ) {
  text 'Popup'
  command proc{ t.deiconify }
  pack
}

TkButton.new( root ) {
  text 'Quit'
  command proc{ root.destroy }
  pack
}

Tk.mainloop

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.