# delete

Destroys an object

Syntax

    delete [-i] <object_id>

Description

Schedules for destruction the object designed by <object_id>. 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.

Examples

Main index, Command index

KVirc 3.0.0 documentation
Generated by root at Thu Apr 29 12:41:05 2004