Hi Harry, I am not entirely sure of what are the pieces of code you want executed for either cases but I noticed that you are comparing osVersionMinor <= 0x50 in both code pieces. Also you're AND'ing both comparisons; Maybe this is sounds dumb but be reminded that if the first argument of the boolean expression yields false then the second isn't even tested (the trouble bit).
>From here, I would follow Lukáš's advice and make absolutely sure that your comparisons are working - i.e. you're comparing numbers with numbers, strings with strings, etc. Debug the code with traces, tap onto the variables you're using for comparision and/or do printfs to figure out what's happening where and why. Separate every if statement (where clauses are composed of other comparisons), put else branches on all ifs, etc. Seems dumb, I know, but will get you sorted. Hope it helps. Cheers, Pedro. On Jan 26, 6:25 pm, Harry van der Wolf <[email protected]> wrote: > I have problems implementing a patch for Hugin. We need a hack to test for > OSX Leopard (10.5.x) and OSX Tiger (10.4.x). I do this by using > wxGetOsVersion. As such this work. > The version is reported in hex. > Leopard 10.5.6 becomes 10.56. Major version 0x10 (=16 decimal), minor > version 0x56 (=86 decimal) > Tiger 10.4.11 becomes 16 decimal, minor version < 80 dec > > There are two pieces of code: > > #if defined __WXMAC__ && defined __ppc__ > > int osVersionMajor; > int osVersionMinor; > > int os = wxGetOsVersion(&osVersionMajor, &osVersionMinor); > > cerr << "osVersionCheck: os is " << os << "\n" << endl; > cerr << "osVersionCheck: osVersionMajor = " << osVersionMajor << endl; > cerr << "osVersionCheck: osVersionMinor = " << osVersionMinor << endl; > > if ((osVersionMajor == 0x10) && (osVersionMinor >= 0x50)) > { > //let the child process exit without becoming zombie > //may do some harm to internal handling by wxWidgets, but hey it's not > working anyway > signal(SIGCHLD,SIG_IGN); > } > #endif > > And the second part is > #if defined __WXMAC__ && defined __ppc__ > int osVersionMajor; > int osVersionMinor; > > int os = wxGetOsVersion(&osVersionMajor, &osVersionMinor); > > cerr << "osVersionCheck: os is " << os << "\n" << endl; > cerr << "osVersionCheck: osVersionMajor = " << osVersionMajor << endl; > cerr << "osVersionCheck: osVersionMinor = " << osVersionMinor << endl; > > if ((osVersionMajor == 0x10) && (osVersionMinor >= 0x50)) > { > if(m_pidLast) > { > if(kill((pid_t)m_pidLast,0)!=0) //if not pid exists > { > DEBUG_DEBUG("Found terminated process: " << > (pid_t)m_pidLast) > > // probably should clean up the wxProcess object which was > newed when the process was launched. > // for now, nevermind the tiny memory leak... it's a hack to > workaround the bug anyway > > //notify dialog that it's finished. > if (this->GetParent()) { > wxProcessEvent event( wxID_ANY, m_pidLast, 0); // assume > 0 exit code > event.SetEventObject( this ); > DEBUG_TRACE("Sending wxProcess event"); > this->GetParent()->ProcessEvent( event ); > } > } > } > } > #endif > > The test checks for 0x10 as major and >=0x50 as minor version. > Leopard system.log: > osVersionCheck: os is 2 > osVersionCheck: osVersionMajor = 16 > osVersionCheck: osVersionMinor = 86 > Tiger log: > osVersionCheck: os is 2 > osVersionCheck: osVersionMajor = 16 > osVersionCheck: osVersionMinor = 73 > > Leopard mentions 16 and 86 and the code is executed => OK > Tiger mentions 16 and 73 (73 being smaller than 80 (0x50). Still the code is > executed => Tiger Hugin hangs. > If I completely remove the code Hugin hangs on Leopard and runs on Tiger, > which is expected behaviour. > I'm completely blind why my code is executed in both cases even though the > second version check for both code snippets is false. I assume I'm doing > something wrong but I have no idea what it is. > > Please can any programmer shine a light on this. > > Harry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group. A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hugin-ptx -~----------~----~----~----~------~----~------~--~---
