On Thu, Jun 5, 2008 at 9:11 PM, John Wells <[EMAIL PROTECTED]> wrote:
>
> Something strange is afoot. Can you help?

Further investigation into this...

This happens because the ruby code contained in the Shoes::app block
is eval'd *before* the gtk loop is entered. Because the quit() call
occurs in the eval'd code, gtk_main_quit is immediately called during
this eval, and the call fails because gtk_main_quit is only valid *if*
gtk_main has first been called.

I'm not a C expert and know virtually nothing of the Ruby C API, but
consider this simple program:

Shoes::app do
  exit()
end

Again, this results in "gtk_main_quit: assertion `main_loops != NULL' failed".

If appears that because the code is evaluated by this call on line 206
in world.c:

code = shoes_load(load_uri_str);

but the start of the actual gtk app isn't called until line 203:

code = shoes_app_start(shoes_world->apps, uri);

Because this is always sequential, I can't imagine a call to exit() in
the main body of the Shoes::app block will ever actually work. This
also explains why the sample *does* work...it responds to a keypress,
and thus the exit() is always called after the UI has been initiated.

I started looking into fixing this, but would appreciate insight and
guidance before I begin shooting at my toes.

Thanks!
John

Reply via email to