Changeset c394de8 for commands.c


Ignore:
Timestamp:
Sep 18, 2010, 5:07:40 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
fc5eef4
Parents:
9190285
git-author:
David Benjamin <davidben@mit.edu> (08/14/10 01:15:47)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 17:07:40)
Message:
Use ref-counting to make editwin ownership saner

When creating an editwin, one creates an editcontext which takes a
reference to the editwin. Likewise, the pointer in owl_global holds
reference. The reference counting manages their ownership claims. In
addition, owl_global_set_typwin_inactive now does release a reference.

Instead, the callback-calling commands take a reference and release it
later. We may wish to further improve that so that the contexts are also
ref-counted such that, when their commands are running, they will not be
deallocated, even if popped. That will avoid the callback dance.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r9190285 rc394de8  
    26932693
    26942694  owl_global_set_typwin_inactive(&g);
    2695   owl_editwin_unref(e);
    26962695}
    26972696
     
    27462745  }
    27472746
     2747  /* Take a reference to the editwin, so that it survives the pop
     2748   * context. TODO: We should perhaps refcount or otherwise protect
     2749   * the context so that, even if a command pops a context, the
     2750   * context itself will last until the command returns. */
     2751  owl_editwin_ref(e);
    27482752  owl_global_set_typwin_inactive(&g);
    27492753  owl_global_pop_context(&g);
Note: See TracChangeset for help on using the changeset viewer.