summaryrefslogtreecommitdiff
path: root/iup/src/iup_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'iup/src/iup_object.c')
-rwxr-xr-xiup/src/iup_object.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/iup/src/iup_object.c b/iup/src/iup_object.c
index 7f4ce23..f0d5dc9 100755
--- a/iup/src/iup_object.c
+++ b/iup/src/iup_object.c
@@ -148,6 +148,8 @@ Ihandle* IupCreate(const char *name)
void IupDestroy(Ihandle *ih)
{
+ Icallback cb;
+
iupASSERT(iupObjectCheck(ih));
if (!iupObjectCheck(ih))
return;
@@ -156,6 +158,9 @@ void IupDestroy(Ihandle *ih)
if (ih->iclass->nativetype == IUP_TYPEDIALOG)
IupHide(ih);
+ cb = IupGetCallback(ih, "DESTROY_CB");
+ if (cb) cb(ih);
+
/* Destroy all its children.
Just need to remove the first child,
IupDetach will update firstchild. */
@@ -165,6 +170,9 @@ void IupDestroy(Ihandle *ih)
/* unmap if mapped and remove from its parent child list */
IupDetach(ih);
+ /* removes names associated with the element */
+ iupRemoveNames(ih);
+
/* destroy the element */
iupClassObjectDestroy(ih);
@@ -172,9 +180,6 @@ void IupDestroy(Ihandle *ih)
if (ih->data)
free(ih->data);
- /* removes all the names associated with the element */
- iupRemoveAllNames(ih);
-
/* destroy the base handle structure */
iHandleDestroy(ih);
}