# Event.rb line 434 : problem occurs while repeated creating a

**URL:** <https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161>\
**Category:** Ruby\
**Created:** [November 24, 2006, 9:28pm UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161 "2006-11-24T21:28:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![teeshift](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@teeshift](https://www.ruby-forum.com/u/teeshift)\
**Post date:** [November 24, 2006, 9:28pm UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161/1 "2006-11-24T21:28:56Z")

</div>

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. ☹

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

---

<div class="post-metadata">

**Author:** ![teeshift](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@teeshift](https://www.ruby-forum.com/u/teeshift)\
**Post date:** [November 25, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161/2 "2006-11-25T15:15:07Z")

</div>

From: “teeshift” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: event.rb line 434 : problem occurs while repeated creating and  
deleteing objects  
Date: Sat, 25 Nov 2006 04:49:19 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> /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.

---

<div class="post-metadata">

**Author:** ![teeshift](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@teeshift](https://www.ruby-forum.com/u/teeshift)\
**Post date:** [December 11, 2006, 11:47am UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161/3 "2006-12-11T11:47:18Z")

</div>

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… ☹ )

```auto
#!/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

```

---

<div class="post-metadata">

**Author:** ![teeshift](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@teeshift](https://www.ruby-forum.com/u/teeshift)\
**Post date:** [December 11, 2006, 11:47am UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161/4 "2006-12-11T11:47:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![teeshift](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@teeshift](https://www.ruby-forum.com/u/teeshift)\
**Post date:** [December 25, 2006, 11:41am UTC](https://www.ruby-forum.com/t/event-rb-line-434-problem-occurs-while-repeated-creating-a/77161/5 "2006-12-25T11:41:34Z")

</div>

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. 🙂

Tee
