equal
deleted
inserted
replaced
93 inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } |
93 inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } |
94 inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) { |
94 inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) { |
95 if (o.d != d) { |
95 if (o.d != d) { |
96 if (o.d) |
96 if (o.d) |
97 o.d->ref.ref(); |
97 o.d->ref.ref(); |
98 if (d && !d->ref.deref()) |
98 T *old = d; |
99 delete d; |
|
100 d = o.d; |
99 d = o.d; |
|
100 if (old && !old->ref.deref()) |
|
101 delete old; |
101 } |
102 } |
102 return *this; |
103 return *this; |
103 } |
104 } |
104 inline QSharedDataPointer &operator=(T *o) { |
105 inline QSharedDataPointer &operator=(T *o) { |
105 if (o != d) { |
106 if (o != d) { |
106 if (o) |
107 if (o) |
107 o->ref.ref(); |
108 o->ref.ref(); |
108 if (d && !d->ref.deref()) |
109 T *old = d; |
109 delete d; |
|
110 d = o; |
110 d = o; |
|
111 if (old && !old->ref.deref()) |
|
112 delete old; |
111 } |
113 } |
112 return *this; |
114 return *this; |
113 } |
115 } |
114 |
116 |
115 inline bool operator!() const { return !d; } |
117 inline bool operator!() const { return !d; } |
172 |
174 |
173 inline QExplicitlySharedDataPointer<T> & operator=(const QExplicitlySharedDataPointer<T> &o) { |
175 inline QExplicitlySharedDataPointer<T> & operator=(const QExplicitlySharedDataPointer<T> &o) { |
174 if (o.d != d) { |
176 if (o.d != d) { |
175 if (o.d) |
177 if (o.d) |
176 o.d->ref.ref(); |
178 o.d->ref.ref(); |
177 if (d && !d->ref.deref()) |
179 T *old = d; |
178 delete d; |
|
179 d = o.d; |
180 d = o.d; |
|
181 if (old && !old->ref.deref()) |
|
182 delete old; |
180 } |
183 } |
181 return *this; |
184 return *this; |
182 } |
185 } |
183 inline QExplicitlySharedDataPointer &operator=(T *o) { |
186 inline QExplicitlySharedDataPointer &operator=(T *o) { |
184 if (o != d) { |
187 if (o != d) { |
185 if (o) |
188 if (o) |
186 o->ref.ref(); |
189 o->ref.ref(); |
187 if (d && !d->ref.deref()) |
190 T *old = d; |
188 delete d; |
|
189 d = o; |
191 d = o; |
|
192 if (old && !old->ref.deref()) |
|
193 delete old; |
190 } |
194 } |
191 return *this; |
195 return *this; |
192 } |
196 } |
193 |
197 |
194 inline bool operator!() const { return !d; } |
198 inline bool operator!() const { return !d; } |