Minor Tk bug on Windows?


(HAL 9000) #1

This problem is still happening to me in
1.6.6… has anyone else seen this?

The behavior is: I define a proc to try to
set a radio button as soon as it gets the
focus… but it crashes.

1.6.1 used to give me a stacktrace; 1.6.6
just says “abnormal program termination.”

Hal Fulton

···

----- Original Message -----
From: “Hal E. Fulton” hal9000@hypermetrics.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, April 25, 2002 11:21 PM
Subject: Re: Minor Tk bug on Windows?

----- Original Message -----
From: nagai@ai.kyutech.ac.jp
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, April 25, 2002 10:12 PM
Subject: Re: Minor Tk bug on Windows?

???
Does the following script crash?

require 'tk’
v = TkVariable.new
(1…3).each{|i|
TkRadioButton.new {
text "Button #{i}"
value i
variable v
bind ‘FocusIn’, proc{v.value=i}
pack
}
}
Tk.mainloop

Yes, it does… see below.

I think I am going to install a newer Ruby and
see what happens.

Are you the maintainer of Ruby/Tk?

I am very impressed by it, but my Tk knowledge
is still growing…

Thank you,
Hal Fulton

/cygdrive/c/ruby/lib/ruby/1.6/tk.rb:596: [BUG] Segmentation fault
ruby 1.6.1 (2000-10-05) [i386-cygwin]
0 [sig] RUBY 1000 stackdump: Dumping stack trace to
RUBY.EXE.stackdump

Stack trace:
Frame Function Args
0253DE18 6103F2F3 (00000064, 0000EA60, 00000000, 6103EF38)
0253DE58 6103F2F3 (88282EE8, 00000006, 00000000, 0253DF10)
0253DE88 6103C9CC (000003E8, 00000006, 000003E8, 6108625C)
0253DEA8 6107AE2F (61086020, 000003E8, 00000006, 0253DF00)
0253DEC8 610700F0 (61086020, 00000006, 0253DEF4, FFFFFFFF)
0253DEE8 610700C5 (00000006, 67D78E30, 67D78E36, 67D78E41)
0253DF08 6106C996 (00000000, 0253DF4C, 10011A1F, 004280AC)
0253E328 67D0AC94 (67D68E53, 0000016F, 0000016F, 00434298)
0253E348 67D68E7B (0000000B, 00000000, FFFFFFFF, 00000003)
0253E380 6100B5BE (00000003, 0044CA2E, 0253E4F0, 0253E4F0)
0253E394 0EAB4A10 (0253E3DC, 00000003, 00000030, 0253E4E0)
0253E4F0 0EAC1164 (004399C4, 0044CA2E, 0044CF64, 00000000)
0253E768 0EABFFAC (004340B8, 0044CF64, 004399C4, 00000004)
0253E7EC 0EAE3D49 (004399C4, 0044CF64, BFF741F7, BFFC9490)
0253E840 0EAEE183 (0044CF64, 0044CF5C, 00411528, 004182D4)
0253E858 0EAEE5AA (0044CF5C, FFFFFFFD, 0044CF5C, 0044CF5C)
End of stack trace (more stack frames may be present)


(Hidetoshi NAGAI) #2

Hi,

···

From: “Hal E. Fulton” hal9000@hypermetrics.com
Subject: Re: Minor Tk bug on Windows?
Date: Fri, 21 Jun 2002 12:46:25 +0900
Message-ID: 00dc01c218d6$eae77320$0300a8c0@austin.rr.com

This problem is still happening to me in
1.6.6… has anyone else seen this?

Probably, current tcltklib.c has memory-allocation problems.
Some of the problems happen only when Tk event-callbacks very
frequently occur. Whenever same sequence of events occurs, if
the events happen not so rapidly, the application has no trouble.
I’m trying to fix them, but still cannot succeed.

Can you try the recent CVS version (1.7.x) ?
However it does not complete to fix the problems,
some of the problems are removed.

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

(HAL 9000) #3

Thanks for your reply…

I think that rapidity has nothing to do with this
particular occurrence. It is easily reproducible
100% of the time for me… one keystroke will do
it.

I have never built Ruby on my Windows machine, but
I can try to do it… I should get a newer gcc
first, I think.

Thank you,
Hal Fulton

···

----- Original Message -----
From: nagai@ai.kyutech.ac.jp
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, June 20, 2002 11:44 PM
Subject: Re: Minor Tk bug on Windows?

From: “Hal E. Fulton” hal9000@hypermetrics.com
Subject: Re: Minor Tk bug on Windows?
Date: Fri, 21 Jun 2002 12:46:25 +0900
Message-ID: 00dc01c218d6$eae77320$0300a8c0@austin.rr.com

This problem is still happening to me in
1.6.6… has anyone else seen this?

Probably, current tcltklib.c has memory-allocation problems.
Some of the problems happen only when Tk event-callbacks very
frequently occur. Whenever same sequence of events occurs, if
the events happen not so rapidly, the application has no trouble.
I’m trying to fix them, but still cannot succeed.

Can you try the recent CVS version (1.7.x) ?
However it does not complete to fix the problems,
some of the problems are removed.


(MENON Jean-Francois) #4

nagai@ai.kyutech.ac.jp wrote:

Hi,

From: “Hal E. Fulton” hal9000@hypermetrics.com
Subject: Re: Minor Tk bug on Windows?
Date: Fri, 21 Jun 2002 12:46:25 +0900
Message-ID: 00dc01c218d6$eae77320$0300a8c0@austin.rr.com

This problem is still happening to me in
1.6.6… has anyone else seen this?

Probably, current tcltklib.c has memory-allocation problems.
Some of the problems happen only when Tk event-callbacks very
frequently occur. Whenever same sequence of events occurs, if
the events happen not so rapidly, the application has no trouble.
I’m trying to fix them, but still cannot succeed.

Can you try the recent CVS version (1.7.x) ?
However it does not complete to fix the problems,
some of the problems are removed.

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

hello,
I don’t know if it will be useful for your problem, but here is what I
noticed under windows:

I make a bind(‘Configure’, proc …) on a frame, to get its dimensions
form the event fields
(because cget(‘width’) return always 0)
** If the frame has a borderwidth > 0, ruby crash ! **
if there is no borderwidth, all works fine.
the crash occurs when the frame is opened, i.e. when the callback
occurs.

jf

···


/ do you play Go? \

http://jeanfrancois.menon.free.fr/rubygo |
\ /


    \   ^__^
     \  (oo)\_______
        (__)\       )\/\
            >>----w |
            >>     >>

(Hidetoshi NAGAI) #5

Hi,

···

From: “Hal E. Fulton” hal9000@hypermetrics.com
Subject: Re: Minor Tk bug on Windows?
Date: Fri, 21 Jun 2002 15:29:30 +0900
Message-ID: 01d801c218ed$aee2a540$0300a8c0@austin.rr.com

I think that rapidity has nothing to do with this
particular occurrence. It is easily reproducible
100% of the time for me… one keystroke will do it.

My sample of problem shows the reason of fail to fix bugs. :slight_smile:
But I think source of the problems is same.

I think the bugs are based on the colision of Ruby’s and Tk’s
memory management. In the script which has trouble, for ForcusIn
event, Tcl/Tk interpreter calls Ruby interpreter to proceed the
bind proc. And Ruby interpreter calls Tcl/Tk interpreter to set
a value to a Tcl variable. After that, Tcl/Tk interpreter removes
the event data structure from the event queue and free the memory
for the event data structure. On this step, data on Ruby and data
on Tcl/Tk have relationship, but Ruby’s and Tk’s memory management
are independent each other. I think either or both of two interpreter
break the other’s data structure.

Thread switching makes the situation extremely complex. And such as
your problem, it seems depend on OS environment. Therefore, I can’t
still find the buggy part.

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

(Hidetoshi NAGAI) #6

Hi,

···

From: MENON Jean-Francois Jean-Francois.MENON@meteo.fr
Subject: Re: Minor Tk bug on Windows?
Date: Mon, 24 Jun 2002 15:22:45 +0900
Message-ID: 3D16BA9F.6974B10B@meteo.fr

I don’t know if it will be useful for your problem, but here is what I
noticed under windows:

I make a bind(‘Configure’, proc …) on a frame, to get its dimensions
form the event fields
(because cget(‘width’) return always 0)
** If the frame has a borderwidth > 0, ruby crash ! **
if there is no borderwidth, all works fine.
the crash occurs when the frame is opened, i.e. when the callback
occurs.

Thank you for your report.
Does it occur on Windows only?
I cannot generate this problem on Linux.
Can you send me a small script which occurs the problem?

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

(HAL 9000) #7

Thank you for your hard work… I am impressed with the job you
have done, and I admit it is not something I could do. :slight_smile:

You mention that thread switching makes it more complex. Aren’t there
threading problems on Windows? I have heard of these lately, but have
not seen them. Is there a connection?

I did many experiments with threading last year, both UNIX and Windows.
But I was using the Cygwin version on Windows then, and now I am not.

Thanks,
Hal Fulton

···

----- Original Message -----
From: nagai@ai.kyutech.ac.jp
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Friday, June 21, 2002 2:34 AM
Subject: Re: Minor Tk bug on Windows?

I think the bugs are based on the colision of Ruby’s and Tk’s
memory management. In the script which has trouble, for ForcusIn
event, Tcl/Tk interpreter calls Ruby interpreter to proceed the
bind proc. And Ruby interpreter calls Tcl/Tk interpreter to set
a value to a Tcl variable. After that, Tcl/Tk interpreter removes
the event data structure from the event queue and free the memory
for the event data structure. On this step, data on Ruby and data
on Tcl/Tk have relationship, but Ruby’s and Tk’s memory management
are independent each other. I think either or both of two interpreter
break the other’s data structure.

Thread switching makes the situation extremely complex. And such as
your problem, it seems depend on OS environment. Therefore, I can’t
still find the buggy part.