~ubuntu-branches/ubuntu/lucid/aptitude/lucid-proposed

« back to all changes in this revision

Viewing changes to README.SMART-POINTERS

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-05-27 10:28:10 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080527102810-pxc090mnjkr4xlek
Tags: 0.4.11.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - 03_branding.dpatch: ubuntu branding
  - 04_changelog.dpatch: take changelogs from changelogs.ubuntu.com
  - 07_hide_recommends_warning.dpatch: do not show a warning about
    missing recommends
  - 08_ubuntu_default_source.dpatch: do not clean lists directory
    on transient network failures
  - 11_gxx43.dpatch:build tests without -Werror
* Updated:
  - 03_branding.dpatch
* Disabled 07_hide_recommends warning because we do install 
  recommends now by default too

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
      generally works as you expect.  To enforce the use of ref_ptr,
97
97
      all widget constructors are protected; static ::create methods
98
98
      are provided to actually allocate a new widget.  Because the
99
 
      vscreen_widget class initializes its reference count to 1, the
 
99
      cwidget::widget class initializes its reference count to 1, the
100
100
      ::create method should explicitly decref() its return value; see
101
101
      the existing ::create routines for examples.
102
102
 
119
119
 
120
120
    - Beware sigc::bind.  sigc::bind is an easy way to create bad
121
121
      circularities; moreover, it's actually unsafe to bind a ref_ptr
122
 
      as a slot argument.  The solution adopted in vscreen/ is to
 
122
      as a slot argument.  The solution adopted in cwidget is to
123
123
      exploit sigc++ weak references.  If w is a ref_ptr, then rather
124
124
      than closing w, you should close over w.weak_ref().
125
125
 
131
131
      a T&; the _bare method should simply instantiate a ref_ptr and
132
132
      call the main interface.  For instance,
133
133
 
134
 
          void add_widget(const ref_ptr<vscreen_widget> &w);
135
 
          void add_widget_bare(vscreen_widget &w)
 
134
          void add_widget(const ref_ptr<cwidget::widget> &w);
 
135
          void add_widget_bare(cwidget::widget &w)
136
136
          {
137
 
            add_widget(ref_ptr<vscreen_widget>(&w));
 
137
            add_widget(ref_ptr<cwidget::widget>(&w));
138
138
          }
139
139
 
140
140
      Obviously this is less than ideal, but it will work.  Be aware,