Project

General

Profile

Bug #5684 ยป fix-web-widget-signal-bookkeeping.patch

Jan Lindemann, 04/27/2017 12:47 PM

View differences:

src/Wt/WWebWidget
520 520
    Signal<bool> scrollVisibilityChanged_;
521 521
    JSignal<bool> *jsScrollVisibilityChanged_;
522 522

  
523
    OtherImpl(WWebWidget *const self);
523
    OtherImpl(WWebWidget *const self, const char *id = 0);
524 524
    ~OtherImpl();
525 525
  };
526 526

  
src/Wt/WWebWidget.C
112 112
    data(aData)
113 113
{ }
114 114

  
115
WWebWidget::OtherImpl::OtherImpl(WWebWidget *const self)
116
  : id_(0),
115
WWebWidget::OtherImpl::OtherImpl(WWebWidget *const self, const char *id)
116
  : id_(id ? new std::string(id) : 0),
117 117
    attributes_(0),
118 118
    jsMembers_(0),
119 119
    jsStatements_(0),
......
125 125
    childrenChanged_(self),
126 126
    scrollVisibilityMargin_(0),
127 127
    scrollVisibilityChanged_(self),
128
    jsScrollVisibilityChanged_(new JSignal<bool>(self, "scrollVisibilityChanged"))
128
    jsScrollVisibilityChanged_(NULL)
129 129
{
130
  self->otherImpl_ = this; // necessary, because next line calls WWebWidget::id()
131
  jsScrollVisibilityChanged_ = new JSignal<bool>(self, "scrollVisibilityChanged");
130 132
  jsScrollVisibilityChanged_->connect(self, &WWebWidget::jsScrollVisibilityChanged);
131 133
}
132 134

  
......
186 188

  
187 189
void WWebWidget::setId(const std::string& id)
188 190
{
189
  if (!otherImpl_)
190
    otherImpl_ = new OtherImpl(this);
191

  
192
  if (!otherImpl_->id_)
193
    otherImpl_->id_ = new std::string();
194

  
195
  *otherImpl_->id_ = id;
191
  if (!otherImpl_) {
192
    otherImpl_ = new OtherImpl(this, id.c_str());
193
  } else {
194
    if (!otherImpl_->id_)
195
      otherImpl_->id_ = new std::string();
196
    *otherImpl_->id_ = id;
197
  }
196 198
}
197 199

  
198 200
void WWebWidget::setSelectable(bool selectable)
    (1-1/1)