An interface enters "preserving-state" context just before it is destroyed by
hcl:save-current-session
, and exits the context just after interface-display returns.
If the interface
interface
is in "preserving-state" context, the result of
:interface-preserving-state-p
is either
t
or
:different-invocation
. The value
t
means that the current invocation of LispWorks is still the same invocation. The value
:different-invocation
means it is a different invocation, in other words it is the saved image that is restarted.
In other circumstances
interface-preserving-state-p
can return
:keeping-processes
, which means that the interfaces are destroyed but processes that are not associated with
interface
are not killed. That currently happens only on Microsoft Windows when the programmer changes the arrangement of IDE windows via
Preferences... > Environment > General > Window Options
.
interface-preserving-state-p
is typically used in the
destroy-callback
of an interface or a pane to decide whether really to destroy the information, and in the
create-callback
or interface-display to decide whether the existing information can be used. Note that if it is a pane, it needs to find the top-level-interface.
Information that is made entirely of Lisp objects can be preserved in all cases. Information that is associated with external objects is invalid when the image is restarted. So when
interface-preserving-state-p
is used inside the
create-callback
or interface-display, external information can be preserved only if it returns
t
. When
interface-preserving-state-p
returns
t
, the external information may be preserved, unless it is tied to the lightweight process.