on timers
- From:
- J. Kaiden
- Date:
- 2011-10-25 @ 23:40
hey folks,
i noticed an interesting issue (to me anyway) using Shoes timers in my
audio player app. i was getting segfaults thrown at me when closing the
main_app window after i had started a timer...
here's the progress method that moves the arm of the record player in my
would-be app:
def xprogress
@timer.remove if @timer
@timer = every(0.25){
if @wax.state == "playing"
if @wax.dur > 0
x = (-5.5 / @wax.dur.to_f).round(3)
@arm.rotate(x)
end
end
}
end
i've also used `@timer = animate(4)`, and gotten the same segfault.
i replaced this method with the one i used in the gtk2 version of the
player. this version of the method relies on glib2, which i built into my
shoes - so i'm not sure (and don't think) that it will work with most
shoes...
def progress
GLib::Timeout.add(100){
if @wax.state == "playing"
if @wax.dur > 0
@arm.rotate(-0.57 / @wax.dur.to_f)
end
end
}
end
anyway, this doesn't give me any errors when i close the app... any ideas
what might be going on? does it even matter?
Shoes On,
- j
Re: [shoes] on timers
- From:
- Steve Klabnik
- Date:
- 2011-10-26 @ 01:32
It does matter, and it doesn't. If we could get it down to a tiny
case, we could make a bit more sense of it. Segfaults are bad. I'd
like to get rid of them.
Re: [shoes] on timers
- From:
- J. Kaiden
- Date:
- 2011-10-26 @ 10:01
hey Steve,
trying to get it down to a small not-working example, with no luck yet...
if/when i do i'll post it here. think it might just be a question of a
million things piled on top of each other. now that it's stripped down,
i'll start piling them on one by one again, and see where it breaks...
thanks,
- j
Re: [shoes] on timers
- From:
- Steve Klabnik
- Date:
- 2011-10-26 @ 15:18
Totally. And it's better to know that it does it sometimes than not,
so thanks for letting us know regardless! _why's C code... has some
bad things in it sometimes. I'm working on improving the overall
quality, but these things take time.
Re: [shoes] on timers
- From:
- J. Kaiden
- Date:
- 2011-10-27 @ 01:10
On Wed, Oct 26, 2011 at 5:18 PM, Steve Klabnik <steve@steveklabnik.com>wrote:
> ... I'm working on improving the overall quality, but these things take
> time.
>
thanks again for all the effort - Shoes is a truly enjoyable experience...
once i've got this thing finished i'm thinking of writing something of a
comparison between creating the beast in gtk2 vs. in shoes...
wish i could help more than just complaining when stuff goes wrong for me!
i'm working on learning more C to try and understand better what goes on
under the hood - but that too takes time! i'll certainly get back when i
figure out what the straw that breaks the timer's back is...
Shoes On,
- j
Re: [shoes] on timers
- From:
- Steve Klabnik
- Date:
- 2011-10-27 @ 03:22
No worries! Answering questions on the ML is super helpful as well. :)