RVargas Posted April 7, 2011 Share Posted April 7, 2011 I have found a really weird problem: when I use a dialog widget to select a file and after that I try to call setText() for a widget (tested with WidgetEditText and WidgetButton) I get an error: ExternClass::run_function(): object is NULL Stack dump: 0x0000: string: "Switch" "Switch" is the string I passed to setText(). Any idea about whats happening here? Link to comment
ulf.schroeter Posted April 7, 2011 Share Posted April 7, 2011 ExternClass::run_function(): object is NULL I would guess that some object variable in your code is not initialized. You should post at least your function code including an indication where the exception is raised.. Link to comment
RVargas Posted April 7, 2011 Author Share Posted April 7, 2011 I would guess that some object variable in your code is not initialized. You should post at least your function code including an indication where the exception is raised.. Here is a simple code: DialogFile::init(); DialogFile::show("Choose dialog file", fileName,"*.xml"); btNew.setText("Switch"); The file selection dialog works fine, and the button exists, fo course, Im just changing its text. Link to comment
ulf.schroeter Posted April 7, 2011 Share Posted April 7, 2011 How is btNew object variable initialized ? Fisrt of all include following test code to verify btNew initialization. DialogFile::init(); DialogFile::show("Choose dialog file", fileName,"*.xml"); if( btNew != 0 ) { btNew.setText("Switch"); } else { log.error("btNew is null"); } Link to comment
RVargas Posted April 7, 2011 Author Share Posted April 7, 2011 I used the widget demo as base: class Window { Gui gui; // gui UserInterface ui; WidgetButton btNew; // New dialog *** Window() { gui = engine.getGui(); btNew = new WidgetButton(gui,"New"); gui.addChild(btNew,GUI_ALIGN_OVERLAP); *** } Also added your code and made a test, it reports that btNew is null. Link to comment
ulf.schroeter Posted April 7, 2011 Share Posted April 7, 2011 Also added your code and made a test, it reports that btNew is null. check if Window() constructor gets called by adding some log messages. In the sample this is done via /* */ void create_scene() { Window window = new Window(); window = window; return "Toggle button"; } Link to comment
RVargas Posted April 7, 2011 Author Share Posted April 7, 2011 Everything works fine, as long as I dont display a DialogFile before. I remove it and the widgets are accessed normally (as I said, I tested with several widgets, which are already created and are perfectly visible). Link to comment
ulf.schroeter Posted April 7, 2011 Share Posted April 7, 2011 Everything works fine, as long as I dont display a DialogFile before. I remove it and the widgets are accessed normally (as I said, I tested with several widgets, which are already created and are perfectly visible). Post a small test-case .cpp/.world for problem reproduction Link to comment
RVargas Posted April 8, 2011 Author Share Posted April 8, 2011 Ok, here it is. I have included all the files, just in case. error.zip Link to comment
RVargas Posted April 8, 2011 Author Share Posted April 8, 2011 A little detail: npcLine.setText("Loading"); <-- This works DialogFile::init(); DialogFile::show("Choose dialog file", fileName,"*.xml"); npcLine.setText("testtt"); <-- This no works Seems that DialogFile is invalidating all my previously created widgets. Also tried calling dialogFile::shutdown after show(), but didnt solved the problem. Link to comment
binstream Posted April 8, 2011 Share Posted April 8, 2011 Our QA will check the problem on Monday. Link to comment
serega Posted April 11, 2011 Share Posted April 11, 2011 Thanks for test-case. Problem assigned to devs. Link to comment
Recommended Posts