On Thursday, September 19, 2002, at 01:18 AM, Frederic Bouvier wrote:
> From: "Jonathan Polley" <[EMAIL PROTECTED]> >> When I rebuilt the MacOS X version of FlightGear, after the 3D cloud >> code was added, I started getting an EXC_BAD_ACCESS runtime error. I >> did some looking around with gdb and found out that the error was >> happening BEFORE the main was being called. >> >> Program received signal EXC_BAD_ACCESS, Could not access memory. >> 0x90989544 in glGetIntegerv () >> (gdb) backtrace >> #0 0x90989544 in glGetIntegerv () >> #1 0x002130b8 in SkyTextureState::SkyTextureState() (this=0x41e0478) >> at SkyTextureState.cpp:47 >> #2 0x00212814 in SkyMaterial::SkyMaterial() (this=0x41e03d0) at >> SkyMaterial.cpp:60 >> #3 0x0016df60 in SkyLight::SkyLight(SkyLight::SkyLightType) >> (this=0x0, > > ^^^^^^^^ > Very strange ! > >> eType=3221223248) at SkyLight.cpp:67 > ^^^^^^^^^^ > Strange too ! > >> #4 0x003167c4 in __static_initialization_and_destruction_0(int, int) >> () >> #5 0x8fe16594 in __dyld_call_module_initializers_for_objects () >> #6 0x8fe160a0 in __dyld_call_module_initializers () >> #7 0x8fe133ac in __dyld__dyld_make_delayed_module_initializer_calls >> () >> #8 0x00002c04 in _call_mod_init_funcs () at >> /SourceCache/Csu/Csu-45/crt.c:299 >> #9 0x00002aec in _start (argc=1, argv=0xbffffc54, envp=0xbffffc5c) at >> /SourceCache/Csu/Csu-45/crt.c:217 >> #10 0x00002a4c in start () >> >> How is this possible? If this were Ada, I would say that it is >> happening during Elaboration, but I'm not sure if C++ has something >> similar. SkyLight::SkyLight is creating a new instance of >> SkyMaterial, >> and my bet is that glGetIntegerv is having the problem because OpenGL >> hasn't been initialized yet. > > I don't looked at the code but it seems that there is a SkyLight global > variable (or a static member one) defined. However, the fact that the > constructor is called with a this null pointer seems odd to me. > > Cheers, > > -Fred > I did see this code block in SkySceneLoader.cpp (I assume that it is global data): // Need to add a light here until we figure out how to use the sun position and color SkyLight::SkyLightType eType = SkyLight::SKY_LIGHT_DIRECTIONAL; SkyLight *pLight = new SkyLight(eType); Is there any way I can defer this until after the main() starts? Thanks, Jonathan Polley _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
