1.1b43 - Toast

Steve Sisak steve.sisak at ioxperts.com
Fri Feb 4 09:19:05 EST 2005


At 9:32 AM +0100 2/3/05, Peter Vendlegård wrote:
>Toast 6.0.7 crashed on launch with this and the b42 driver. That is not good.

I think I just fixed this (I've sent you a logging build off list).

For the C++ programmers on the list, it appears 
to been a compiler bug and/or Mach-O/dyld 
weirdness.

What's happening is that Toast is calling the 
Component Manager while dyld is loading a bundle, 
presumably from the constructor of a static C++ 
object -- I won't comment on how massively 
illegal this is.

As a result, the Component Manager is loading and 
calling us at a strange time and the vtable of a 
two objects in our code is never initialized 
(constructor not called?) and the first virtual 
method call on that object causes a crash.

I worked around it by replacing:

static MyClass sfoo;

with

static MyClass& GetmyFoo()
{
    static MyClass* gFoo = nil;

    if (!gFoo)
    {
       gFoo = new MyClass;
    }

    return *gFoo;
}

Very ugly but seems to work. I need to verify if there's something better.

I'm going to consider this a partial solution 
because there may be other partially constructed 
objects lying around (but by the time the 
application is running, everything should be 
fine).

The fix will be in the next build -- if anyone 
needs it before then, please contact me offline.

-Steve

-- 
_________________________________________________________________________
Steve Sisak, CTO                                 steve.sisak at ioxperts.com
IOXperts, Inc.                                     voice: +1 617 876-2572
87 Bristol St #3A                                    fax: +1 617 876-2337
Cambridge, MA 02139                               mobile: +1 617 388-6476



More information about the Video-Beta-Discuss mailing list