From 1a7f159fad78b51d3aeffc9da76619e53308794c Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 May 2003 21:26:38 +0000 Subject: [PATCH] * only call destructor in except block when there is a destructor available --- compiler/psub.pas | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/compiler/psub.pas b/compiler/psub.pas index 4ef843955a..f13cc863ad 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -427,8 +427,10 @@ implementation begin generate_except_block:=internalstatements(newstatement,true); - { a constructor needs call destroy when it is not inherited } - if (current_procdef.proctypeoption=potype_constructor) then + { a constructor needs call destructor (if available) when it + is not inherited } + if assigned(current_procdef._class) and + (current_procdef.proctypeoption=potype_constructor) then begin pd:=current_procdef._class.searchdestructor; if assigned(pd) then @@ -440,9 +442,7 @@ implementation cnilnode.create), ccallnode.create(nil,tprocsym(pd.procsym),pd.procsym.owner,load_self_node), nil)); - end - else - internalerror(200305107); + end; end else begin @@ -1127,7 +1127,11 @@ implementation end. { $Log$ - Revision 1.111 2003-05-13 19:14:41 peter + Revision 1.112 2003-05-13 21:26:38 peter + * only call destructor in except block when there is a destructor + available + + Revision 1.111 2003/05/13 19:14:41 peter * failn removed * inherited result code check moven to pexpr