Form.Release + NIL

后端 未结 5 1343
无人及你
无人及你 2021-02-05 21:24

if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil.

if not assigned (Form1) then
  begin
    Ap         


        
5条回答
  •  甜味超标
    2021-02-05 21:33

    Release is just a (potentially) deferred Free. The 1st thing you should do after calling Release is nilling the variable.
    Then, you'll be safe even if some code tries to reference Form1 before it is actually destroyed. In a case like in your code, it would just safely recreate another Form1 for the new usage without bothering the one being destroyed.

提交回复
热议问题