Destroy error org.apache.wicket.WicketRuntimeException

This method works fine in smart client but gives the following error in webclient:

Destroy error org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!

// Ask confirmation
var choice = globals.mod_webdialog_showDialog('Logout','Do you really want to logout?','Cancel','Logout');
if(choice)
{
	// Transform in INT
	parseInt(choice)
}
else
{
	return;
}

if(choice > 1)
{
	// Logout and redirect to http page
	application.showURL('http://www.sintpro.com/wc/wc_logout_eng.html','_self')
	application.exit();
}

globals.mod_webdialog_showDialog():

var title =  arguments[0]
var message =  arguments[1]
var btn1 =  arguments[2]
var btn2 =  arguments[3]

if(title && message && btn1 && btn2)
{
	// Set the buttons
	forms.sintpro_webdialog_dialog.elements.btn1.text = btn1
	forms.sintpro_webdialog_dialog.elements.btn2.text = btn2
	
	// Set the message
	globals.g_webdialog_text = message
	
	// Reset the status
	globals.g_webdialog_status = null
	
	// Show the dialog
	application.showFormInDialog(forms.sintpro_webdialog_dialog,-1,-1,-1,-1,title,false,false,'webdialog_mod',true)
	
	// Return the exit status (pressed button)
	return globals.g_webdialog_status;
}
else
{
	return null;
}

If I do not show the dialog everything works fine, any hint?

that error doesn’t have anything to do with your error
the problem is that the script doesn’t stop when showing a modal dialog in the webclient.
So your code is just executing directly.

In webclient you have to do

//script1
showForInDialog
// Don’t do anything

//script2 (onHide or onaction of a button of the form in dialog)
do your stuff.

Ouch!
Thanks Johan!