michael.zhang Posted October 7, 2011 Share Posted October 7, 2011 What does this error mean? It occurs when I call wait 1; Below is an excerpt of code where errors are occuring. The first error occurs when the dialog is opened, the second error occurs after it is closed. class DialogTargetCharacterNearest : CustomDialog{ TargetCharacterNearest target; WidgetButton changeType; WidgetButton editReference; DialogTargetCharacterNearest(TargetCharacterNearest target){ CustomDialog::__CustomDialog__(); this.target = target; dialog.setText("Edit Target Character Nearest"); WidgetLabel label = new WidgetLabel(gui, "Reference Target: "); editReference = new WidgetButton(gui, "Edit"); changeType = new WidgetButton(gui, "Change Type"); dialog.addChild(editReference, GUI_ALIGN_EXPAND); dialog.addChild(changeType, GUI_ALIGN_EXPAND); dialog.arrange(); WidgetButton cancelButton = dialog.getCancelButton(); cancelButton.setEnabled(0); editReference.setCallback(GUI_CLICKED, "DialogTargetCharacterNearest::edit_clicked", this); changeType.setCallback(GUI_CLICKED, "DialogTargetCharacterNearest::type_clicked", this); gui.addChild(dialog, GUI_ALIGN_OVERLAP | GUI_ALIGN_CENTER); dialog.setFocus(); } ~DialogTargetCharacterNearest(){ CustomDialog::__~CustomDialog__(); } void changeReferenceType(){ log.message("1"); dialog.setEnabled(0); DialogNewTarget nt = new DialogNewTarget(); log.message("c"); while(!nt.isDone()){ wait 1; } // ERror HERE! log.message("d"); if(nt.isOk()){ Target reference = nt.newTarget(); target.setReference(reference); } delete nt; dialog.setEnabled(1); log.message("2"); // AFTER this line, but BEFORE the below marked line * // ERROR: Variable::getTypeInfo(): unknown type of Variable } void type_clicked(DialogTargetCharacterNearest dt){ log.message("a"); dt.changeReferenceType(); // This function never returns :( log.message("b"); } }; Console output is: a1cInterpreter::runFunction(): depth of stack is not zero d2Variable::getTypeInfo(): unknown type of Variable I would provide a small test case, but the classes involved form quite a large hierarchy. Link to comment
steve3d Posted October 8, 2011 Share Posted October 8, 2011 wait is a keyword, and don't need a parameter. Link to comment
michael.zhang Posted October 8, 2011 Author Share Posted October 8, 2011 Indeed, I just copied that code from the editor_dialogs.h:64 Please notice, that wait construct is valid only for simple functions. If the class instance is set, an error will be generated. However, wait is possible if the class function is used as a simple function (analogous to static function), This is actually why I'm getting this error. Didn't see that disclaimer in the docs. Getting rid of this error got rid of the other errors as well. For anyone else facing this problem in the future, you should simply move the while-wait construct into the static callback. Link to comment
manguste Posted October 12, 2011 Share Posted October 12, 2011 Added to common run-time errors list. Link to comment
Recommended Posts