Schedules for destruction the object designed by <objectHandle>.
This command is internally aliased to destroy.
Please note that the object is NOT immediately destroyed:
it will be destroyed when KVIrc returns to the main event loop,
so after the current script code part has been executed.
This behaviour makes the object destruction safe in any
part of the script, but may lead to problems when
using signals and slots.
For example, when you delete an object that emits some signals,
the signals may be still emitted after the delete call.
You have to disconnect the signals explicitly if you don't want it
to happen.
Alternatively you can use the -i switch: it causes the object
to be destructed immediately but is intrinsicly unsafe:
in complex script scenarios it may lead to a SIGSEGV;
usually when called from one of the deleted object function
handlers, or from a slot connected to one of the deleted object
signals. Well, it actually does not SIGSEGV, but I can't guarantee it;
so, if use the -i switch, test your script 10 times before releasing it.
The -q switch causes the command to run a bit more silently: it still
complains if the parameter passed is not an object reference, but
it fails silently if the reference just points to an inexisting object (or is null).
|