In article <[EMAIL PROTECTED]>,
 Randell Jesup <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] (Joaquin Blas) writes:
> >FYI, before the editor code can use a weak reference for the ViewManager,
> >but first the ViewManager's implementation class has to derive from
> >nsSupportsWeakReference.
> 
>         Ok, that brings me around to my original comment: why is this
> a hand-rolled weak reference?

Using a strong reference could introduce cycles. Ownership of editor
looks something like:

Compser (now):
 nsEditor <- nsEditorShell <- nsEditorBoxObject <- frames <- nsPresShell....

Text widgets:

 nsEditor <- nsGfxTextControlFrame2 <- nsPresShell....

So if editor starts holding on to something that indirectly
also holds onto pres shells etc, we might end up with a long cycle.

Strong refs should *only* be used where you really want an owning
ref to something. If the editor outlives the view manager (perish the
thought), then something is really wrong elsewhere.

Simon

-- 
          Simon Fraser   Entomologist
  [EMAIL PROTECTED]   http://people.netscape.com/sfraser/

Reply via email to