"R. Lahaye" <[EMAIL PROTECTED]> writes: | Andre Poenitz wrote: >> >> On Mon, Jul 01, 2002 at 12:02:51PM +0900, R. Lahaye wrote: >> > It's the recursion call in math_support.C::searchFont at line 596. >> >> Ah... this probably means it does not find the proper point >> for mathnormal and due to my stupid way to implement this fall >> back you run into an infinite loop and the SIGSEGV is probably >> a stack overflow. >> >> I think I just fix it with something similar as you use right >> now (I'll only move "mathnormal" higher up in the list to >> position 0) > | No, the crash does NOT occur WHILE performing the searchFont routine! | The SIGSEGV happens later (in math_factory.C::readSymbols(), remember?). | However, changing math_support.C::searchFont() the way I described | previously, prevents the SIGSEGV to happen. A weird thing, isn't it? > | It's getting even more weird: > | The modification of searchFont() below works fine. Simply add a dummy | char array declarartion; a size of nine chars is minimum, smaller array | will crash when in readSymbols(), any larger array size is OK. > | ------------ math_support.C --------------------- | fontinfo * searchFont(string const & name) | { | int const n = sizeof(fontinfos) / sizeof(fontinfo); | char dummy[9]; // dummy declaration, without being used !?!? > | for (int i = 0; i < n; ++i) | if (fontinfos[i].cmd_ == name) { | return fontinfos + i; | } | return searchFont("mathnormal"); | } | -------------------------------------------------- > | Somehow, this may force a correct stack management, or something. > | Do you understand this, or does this show at last that there's obviously | something fishy whith my compiler, when it comes to the string variables | and the stack management? (it's gcc 2.95.3) > | BTW: your own solution applied to CVS to avoid the recursion by | "return fontinfos", works also fine here; since the recursion appears | to be the culprit.
It seems to me that it is just too easy to recurse too deep. Would using a more controlled container for fontinfos help there? (vector, map?) And why have this function recurse anyway? -- Lgb