Hans  Fugal wrote:

>> QtRuby used to callcc() to jump out of the constructor, instead of using
>> an exception. It looks to me as though that change has somehow got messed
>> up in the debian version.
> 
> Well, except I first had the problem in the original tarballs (1.0.9
> and 1.0.10) that I had downloaded from rubyforge, and then noticed that
> the debian package was behaving the same way and that someone had
> opened a bug report on it. So it seems it must be the way it interacts
> with something on a Debian system.
I would be surprised if QtRuby 1.0.9 and 1.0.10 had this problem. 

What happened was that I committed a fix for the 'polluted namespace' bug in
QtRuby, and at the same time I fixed the way callcc() was giving a
confusing stack trace in KDevelop by replacing it with throwing an
exception. The Debian maintainer asked which parts of the commit were for
the namespace problem, and then backported them to the Debian sources. I
think whats happened is that part of the callcc() fix was wrongly applied.

> The bit about repeating stuff worries me. I had no idea everything
> before super would be executed twice (but sure enough that seems to be
> the case on my laptop - I think it's instructive that on our debian
> systems it only prints 'init in CD' once).  Is calling super first a
> rule in ruby that I somehow missed, or an assumption that either needs
> to be changed or trumpeted from the rooftops?
Is it possible to have a look at the Qt.cpp and qtruby.rb sources from the
Debian release, and I will be able to tell what's going on? Here is what
the code looks like that uses exceptions. Can you see what these methods
look like in the Debian version?

From Qt.cpp:

static VALUE
initialize_qt(int argc, VALUE * argv, VALUE self)
{
    ...

    free(temp_stack);
    // Off with a longjmp, never to return..
    rb_throw("newqt", result);
    /*NOTREACHED*/
    return self;
}

From qtruby.rb:

def Internal.try_initialize(instance, *args)
    initializer = instance.method(:initialize)
    catch "newqt" do
        initializer.call(*args)
    end
end

-- Richard