不用下面代码:
//if assigned(tempform) then
//begin
  //tempform.free;
 // tempform:=nil;
//end;  
在form-> tempform中的onclose中加入
action := caFree;
在form-> tempform中的ondestory中加入
tempform := nill;
我手头没有delphi记不太清了,要是不行把onclose与ondestory代码换一换一定行。