Event.rb line 434 : problem occurs while repeated creating and deleteing objects

Well... I have built a tiny canvas program using Ruby/Tk.
Essentially it has many rectangles on the canvas. With mouse 'enter' a
rectangle,
I would show a info about it and when mouse 'leave' the rectangle. The
info would go away.
The info is embeded inside a repeatedly created and destroyed
rectangle.
I got

/usr/lib/ruby/1.9/tk/event.rb:434: [BUG] Segmentation fault
ruby 1.9.0 (2006-04-21) [i486-linux]

on the 27 tries of 'enter-leave' every single time.

I have also used the 'cheating' method which is generate one single
rectangle
and hide/show by moving the rectangle outside and inside the visiable
canvas.

again.. the same error message (yes, line 4343) but I could always
tries 56 times. :frowning:

Any good idea how to go around this problem?
And since it is a segmentation fault, I guess there is no way to catch
and rescue
it by restarting another process running the same application?

Thank you.

Tee

Message-ID: <1164194940.722117.173420@h48g2000cwc.googlegroups.com>

/usr/lib/ruby/1.9/tk/event.rb:434: [BUG] Segmentation fault
ruby 1.9.0 (2006-04-21) [i486-linux]

Could you try the followings?

* Please check consistency of native-thread support between
   Ruby and Tcl/Tk.

* Please try the latest version of Ruby/Tk.

* Please send me your Tcl/Tk's version and your code which
   causes SEGV.

···

From: "teeshift" <teeshift@gmail.com>
Subject: event.rb line 434 : problem occurs while repeated creating and deleteing objects
Date: Sat, 25 Nov 2006 04:49:19 +0900

--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Well.. I have tried several times without success so here it is ...

Linux source 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686
GNU/Linux
Ubuntu, Edgy

Ruby and Tk is all 1.9

I have modified to find out the shortest code possible that will
generate the same error.
If you move around mouse frequently enough, like continuously for about
30 seconds,
the program will crash.

So here is the code: ( it is really simple... and it crashes.. :frowning: )

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/ruby1.9

class Draw

  require 'dec2ox'

  def initialize(root, width, height)
      @canvas = TkCanvas.new(root)
      @canvas.width = width
      @canvas.height = height
      @canvas.background = '#FFFFFF'
      @canvas.pack

      TkcText.new(@canvas, 100,200, 'text' => ' ', 'tags' =>
'text')

      @canvas.bind('Motion', proc{|e| @canvas.itemconfigure('text',
'text' => e.x.to_s + " " + e.y.to_s)})

  end

end

require 'tk'

monitor_width = 500
monitor_height = 250
root = TkRoot.new
Draw.new(root, monitor_width, monitor_height)

Tk.mainloop

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hidetoshi NAGAI wrote:

From: "teeshift" <teeshift@gmail.com>
Subject: event.rb line 434 : problem occurs while repeated creating and deleteing objects
Date: Sat, 25 Nov 2006 04:49:19 +0900
Message-ID: <1164194940.722117.173420@h48g2000cwc.googlegroups.com>
> /usr/lib/ruby/1.9/tk/event.rb:434: [BUG] Segmentation fault
> ruby 1.9.0 (2006-04-21) [i486-linux]

Could you try the followings?

* Please check consistency of native-thread support between
   Ruby and Tcl/Tk.

* Please try the latest version of Ruby/Tk.

* Please send me your Tcl/Tk's version and your code which
   causes SEGV.

--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

oh... you don't really need dec2ox.
it still crashes... it is a library code I forgot to delete

teeshift wrote:

···

Well.. I have tried several times without success so here it is ...

Linux source 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686
GNU/Linux
Ubuntu, Edgy

Ruby and Tk is all 1.9

I have modified to find out the shortest code possible that will
generate the same error.
If you move around mouse frequently enough, like continuously for about
30 seconds,
the program will crash.

So here is the code: ( it is really simple... and it crashes.. :frowning: )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/ruby1.9

class Draw

  require 'dec2ox'

  def initialize(root, width, height)
      @canvas = TkCanvas.new(root)
      @canvas.width = width
      @canvas.height = height
      @canvas.background = '#FFFFFF'
      @canvas.pack

      TkcText.new(@canvas, 100,200, 'text' => ' ', 'tags' =>
'text')

      @canvas.bind('Motion', proc{|e| @canvas.itemconfigure('text',
'text' => e.x.to_s + " " + e.y.to_s)})

  end

end

require 'tk'

monitor_width = 500
monitor_height = 250
root = TkRoot.new
Draw.new(root, monitor_width, monitor_height)

Tk.mainloop

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hidetoshi NAGAI wrote:
> From: "teeshift" <teeshift@gmail.com>
> Subject: event.rb line 434 : problem occurs while repeated creating and deleteing objects
> Date: Sat, 25 Nov 2006 04:49:19 +0900
> Message-ID: <1164194940.722117.173420@h48g2000cwc.googlegroups.com>
> > /usr/lib/ruby/1.9/tk/event.rb:434: [BUG] Segmentation fault
> > ruby 1.9.0 (2006-04-21) [i486-linux]
>
> Could you try the followings?
>
> * Please check consistency of native-thread support between
> Ruby and Tcl/Tk.
>
> * Please try the latest version of Ruby/Tk.
>
> * Please send me your Tcl/Tk's version and your code which
> causes SEGV.
>
> --
> Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Well... it seems odd that the simple code will fail.
I didn't realize that Ruby 1.9 is not stable yet. ( It is on the list
of Synaptic software manager!)

I simply installed the stable version of both Ruby and Tcl/Tk.. and
wola!
it works. All the previous problems are gone. :slight_smile:

Tee

teeshift wrote:

···

oh... you don't really need dec2ox.
it still crashes... it is a library code I forgot to delete

teeshift wrote:
> Well.. I have tried several times without success so here it is ...
>
> Linux source 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686
> GNU/Linux
> Ubuntu, Edgy
>
> Ruby and Tk is all 1.9
>
> I have modified to find out the shortest code possible that will
> generate the same error.
> If you move around mouse frequently enough, like continuously for about
> 30 seconds,
> the program will crash.
>
> So here is the code: ( it is really simple... and it crashes.. :frowning: )
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> #!/usr/bin/ruby1.9
>
>
> class Draw
>
> require 'dec2ox'
>
> def initialize(root, width, height)
> @canvas = TkCanvas.new(root)
> @canvas.width = width
> @canvas.height = height
> @canvas.background = '#FFFFFF'
> @canvas.pack
>
> TkcText.new(@canvas, 100,200, 'text' => ' ', 'tags' =>
> 'text')
>
> @canvas.bind('Motion', proc{|e| @canvas.itemconfigure('text',
> 'text' => e.x.to_s + " " + e.y.to_s)})
>
> end
>
>
>
> end
>
> require 'tk'
>
> monitor_width = 500
> monitor_height = 250
> root = TkRoot.new
> Draw.new(root, monitor_width, monitor_height)
>
>
> Tk.mainloop
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
>
> Hidetoshi NAGAI wrote:
> > From: "teeshift" <teeshift@gmail.com>
> > Subject: event.rb line 434 : problem occurs while repeated creating and deleteing objects
> > Date: Sat, 25 Nov 2006 04:49:19 +0900
> > Message-ID: <1164194940.722117.173420@h48g2000cwc.googlegroups.com>
> > > /usr/lib/ruby/1.9/tk/event.rb:434: [BUG] Segmentation fault
> > > ruby 1.9.0 (2006-04-21) [i486-linux]
> >
> > Could you try the followings?
> >
> > * Please check consistency of native-thread support between
> > Ruby and Tcl/Tk.
> >
> > * Please try the latest version of Ruby/Tk.
> >
> > * Please send me your Tcl/Tk's version and your code which
> > causes SEGV.
> >
> > --
> > Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)