# Re: hang on leopard

**URL:** <https://www.ruby-forum.com/t/re-hang-on-leopard/129515>\
**Category:** wxRuby\
**Created:** [February 19, 2008, 6:54am UTC](https://www.ruby-forum.com/t/re-hang-on-leopard/129515 "2008-02-19T06:54:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhang\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/cdc98d/32.png) [@Zhang\_P](https://www.ruby-forum.com/u/Zhang_P)\
**Post date:** [February 19, 2008, 6:54am UTC](https://www.ruby-forum.com/t/re-hang-on-leopard/129515/1 "2008-02-19T06:54:27Z")

</div>

Hi Alex,

An update:

The error messages do not happen if I do not do show/hide the 2 dialog  
boxes.

Is there anything that I should do before calling show(false) and  
show(true)?

Thanks in advance!

----- Original Message ----  
From: Zhang P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: General discussion of wxRuby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Monday, February 18, 2008 4:04:56 PM  
Subject: Re: [wxruby-users] hang on leopard

Hi Alex,

Thanks. I’ll look into it.

BTW, just an FYI: The “hang” problem disappears after I restart my  
leopard machine, and I’m back to my original issues where I kept  
getting the following message at random times (the code works, however):

2008-02-18 16:00:06.129 ruby[686:10b] \*\*\* Exception handlers were not  
properly removed. Some code has jumped or returned out of an  
NS\_DURING…NS\_HANDLER region without using the NS\_VOIDRETURN or  
NS\_VALUERETURN macros.  
Mon Feb 18 16:00:06 djonli-djonlis-macbook-pro-17.local ruby[686]  
: CGContextRestoreGState: invalid context

What could I had done wrong?

Regards … Djonli.

----- Original Message ----  
From: Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: General discussion of wxRuby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Monday, February 18, 2008 11:24:21 AM  
Subject: Re: [wxruby-users] hang on leopard

Zhang

Zhang  
Peng  
wrote:

> 

1. 

A  
dialog  
box  
that  
shows  
numbers  
in  
flashing  
fashion.  
This  
dialog

> 

has  
a  
number  
thread  
that  
shows  
a  
number,  
sleep,  
show  
next  
number,

> 

sleep,  
…

> 

1. 

A  
dialog  
box  
that  
shows  
running  
time  
(one  
thread),  
and  
another

> 

thread  
running  
waiting  
for  
the  
number  
thread  
to  
finish  
showing  
the

> 

numbers,  
and  
wait  
for  
a  
user  
to  
type  
in  
the  
result  
of  
adding  
up  
those

> 

numbers.  
It  
sounds  
like  
you  
are  
using  
the  
Threads  
just  
to  
time  
events  
rather  
than  
carry  
out  
more  
complex  
background  
tasks.  
In  
this  
case  
I  
would  
strongly  
recommend  
that  
you  
use  
Wx::Timer  
directly.  
This  
will  
give  
you  
more  
accurate  
timing  
than  
using  
threads  
and  
sleep,  
and  
will  
avoid  
the  
complexity  
of  
using  
threads  
as  
well.

As  
of  
1.9.4,  
there’s  
simple  
idioms  
for  
using  
Timer:

Wx::Timer.every(milliseconds)  
do

# 

repeated  
event  
end

Wx::Timer.after(milliseconds)  
do

# 

delayed  
event  
end

There’s  
an  
example  
of  
a  
ticking  
clock  
in  
bigdemo/wxStatusBar.rbw  
in  
the  
samples,  
which  
uses  
Wx::Timer.  
This  
might  
be  
helpful.

cheers  
alex

* * *

wxruby-users  
mailing  
list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/wxruby-users](http://rubyforge.org/mailman/listinfo/wxruby-users)

```
  Be a better friend, newshound, and

```

know-it-all with Yahoo! Mobile. Try it now.

-----Inline Attachment Follows-----

* * *

wxruby-users  
mailing  
list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/wxruby-users](http://rubyforge.org/mailman/listinfo/wxruby-users)

```
  ____________________________________________________________________________________

```

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
[http://tools.search.yahoo.com/newsearch/category.php?category=shopping](http://tools.search.yahoo.com/newsearch/category.php?category=shopping)

---

<div class="post-metadata">

**Author:** ![Zhang\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/cdc98d/32.png) [@Zhang\_P](https://www.ruby-forum.com/u/Zhang_P)\
**Post date:** [February 19, 2008, 9:52am UTC](https://www.ruby-forum.com/t/re-hang-on-leopard/129515/2 "2008-02-19T09:52:08Z")

</div>

Zhang P. wrote:

> The error messages do not happen if I do not do show/hide the 2 dialog  
> boxes.
> 
> Is there anything that I should do before calling show(false) and  
> show(true)?  
> Not that I can think of. It might be worth checking the first argument  
> to Dialog.new - I would recommend that the Dialogs are given the frame  
> as the parent, not nil. You may be doing this already.

> 2008-02-18 16:00:06.129 ruby[686:10b] \*\*\* Exception handlers were not  
> properly removed. Some code has jumped or returned out of an  
> NS\_DURING…NS\_HANDLER region without using the NS\_VOIDRETURN or  
> NS\_VALUERETURN macros.

I haven’t seen this error message before. If you’re able to isolate the  
error, please post the code as I use Leopard as my main OS and could  
give try it out.

thanks  
alex
