void Posted October 11, 2010 Share Posted October 11, 2010 Try clean content of some node in WidgetTreeBox, when node is expanded - tree.setItemHidden(root, 0) - everything correct, otherwise - tree.setItemHidden(root, 1) - application crashes. Test code: Gui gui = engine.getGui(); WidgetWindow window; WidgetTreeBox tree; int createNode(string name, int count,int hide) { int root = tree.addItem(name); for (int i=0; i<count; i++) { int pos = tree.addItem(format("item_%i",i)); tree.setItemParent(pos,root); } tree.setItemHidden(root, hide); WidgetButton btn = new WidgetButton(gui,format("erase_%s",name)); btn.setCallback(GUI_CLICKED,"erase",root); window.addChild(btn,GUI_ALIGN_LEFT); return root; } void erase(int root) { log.message("erase [%s]\n",tree.getItemText(root) ); tree.setItemHidden(root, 0); // this does not help =( for (int i=tree.getNumItemChilds(root)-1;i>=0; i--) { int pos = tree.getItemChild(root, i); tree.removeItem(pos); } } int init() { engine.game.setPlayer(new PlayerSpectator()); engine.app.setUpdate(1); window = new WidgetWindow(gui); tree = new WidgetTreeBox(gui); window.addChild(tree,GUI_ALIGN_EXPAND); engine.gui.addChild(window,GUI_ALIGN_OVERLAP); createNode("A",3,0); // works createNode("B",3,1); // crash return 1; } Link to comment
Guest extaliones Posted October 14, 2010 Share Posted October 14, 2010 I have check your code sample it works fine. Please, see the attached screenshots. Note that WidgetTreeBox::setItemHidden method expands or collapses a hierarchy of a given item. For further testing the problem, please, give us the following information: - OS - log file - builds version Link to comment
void Posted October 15, 2010 Author Share Posted October 15, 2010 Hi extaliones. As one can see from your screenshots you expand node B before erasing, hold it collapsed - just press sequentially erase_A, erase_B. Link to comment
Guest extaliones Posted October 15, 2010 Share Posted October 15, 2010 Sorry, but I tried many combination and never get a crash. What builds version do you use? Link to comment
void Posted October 15, 2010 Author Share Posted October 15, 2010 I'm use DEBUG build of Unigine-20100907-src. Link to comment
michael.zhang Posted October 20, 2010 Share Posted October 20, 2010 I'm use DEBUG build of Unigine-20100907-src. Hey, just wanted to say I tried running your code and did not have a crash using release build 2010-09-07 binary , Windows 7 64. However, running it in Debug causes crash :) Link to comment
pit Posted October 21, 2010 Share Posted October 21, 2010 Hey, just wanted to say I tried running your code and did not have a crash using release build 2010-09-07 binary , Windows 7 64. However, running it in Debug causes crash :) It is not crash indeed. This is failed assertation. Assert macro (both standart and unigine redefinition) does not any affect in release build (to be more precise: when defined NDEBUG macro). You are may be confused by the fact that assertaion failed but application runs after it without any problem (I think it is very uncommon situation). In more common case application crashes in release build too. Link to comment
void Posted November 9, 2010 Author Share Posted November 9, 2010 So..always use a release build? Link to comment
Recommended Posts