RE: [Plib-users] PUI: getLegend bug?
Brought to you by:
sjbaker
From: SkyFlash <sky...@ch...> - 2003-03-19 17:36:55
|
> This is odd, I don't think C-language string constants > (literals) should be destroyed or become invalid when they > are "out of scope"- Neither did I. :) > Certainly the most typical legend usage I have is: > > button->setLegend("My Button"); > > and it works fine. C++ standard library "strings" are an > other thing, and they might cause problems. Well, what I did was something like this: string charactername; if (characterexists) m_characterselect->setLegend (charactername.c_str()) else m_characterselect->setLegend ("None") Now, wheneever there was no character and the static "None" was set it crashed. This here works fine: if (characterexists) m_characterselect->setLegend (charactername.c_str()) //else // m_characterselect->setLegend ("None") And it displays the character names on the buttons. Of course it probably trashes memory at some point. :P Ralf Pietersz |