Skip to content

Commit b53b58b

Browse files
author
Kjell Ahlstedt
committed
trackable, slot, signal: Remove noexcept specifications
* sigc++/functors/macros/slot.h.m4: * sigc++/functors/slot_base.[h|cc]: * sigc++/signal_base.[h|cc]: * sigc++/trackable.[h|cc]: Remove noexcept from the move operators. Bug #756484.
1 parent 1ad7f93 commit b53b58b

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

sigc++/functors/macros/slot.h.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ FOR(1, $1,[
9191
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
9292
* @param src The existing slot to move or copy.
9393
*/
94-
slot$1(slot$1&& src) noexcept
94+
slot$1(slot$1&& src)
9595
: slot_base(std::move(src))
9696
{}
9797
@@ -110,7 +110,7 @@ FOR(1, $1,[
110110
* @param src The slot from which to move or copy.
111111
* @return @p this.
112112
*/
113-
slot$1& operator=(slot$1&& src) noexcept
113+
slot$1& operator=(slot$1&& src)
114114
{
115115
slot_base::operator=(std::move(src));
116116
return *this;

sigc++/functors/slot_base.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ slot_base::slot_base(const slot_base& src)
124124
}
125125
}
126126

127-
slot_base::slot_base(slot_base&& src) noexcept
127+
slot_base::slot_base(slot_base&& src)
128128
: rep_(nullptr),
129129
blocked_(src.blocked_)
130130
{
@@ -219,7 +219,7 @@ slot_base& slot_base::operator=(const slot_base& src)
219219
return *this;
220220
}
221221

222-
slot_base& slot_base::operator=(slot_base&& src) noexcept
222+
slot_base& slot_base::operator=(slot_base&& src)
223223
{
224224
if (src.rep_ == rep_)
225225
{

sigc++/functors/slot_base.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ class SIGC_API slot_base : public functor_base
244244
{
245245
typedef internal::slot_rep rep_type;
246246

247+
// Move operations are not declared noexcept because
248+
// 1. they may copy instead of move
249+
// 2. when they don't copy, they call src.rep_->notify_callbacks(), which
250+
// may throw an exception.
247251
public:
248252
/// Constructs an empty slot.
249253
slot_base();
@@ -262,7 +266,7 @@ class SIGC_API slot_base : public functor_base
262266
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
263267
* @param src The existing slot to move or copy.
264268
*/
265-
slot_base(slot_base&& src) noexcept;
269+
slot_base(slot_base&& src);
266270

267271
~slot_base();
268272

@@ -344,7 +348,7 @@ class SIGC_API slot_base : public functor_base
344348
* @param src The slot from which to move or copy.
345349
* @return @p this.
346350
*/
347-
slot_base& operator=(slot_base&& src) noexcept;
351+
slot_base& operator=(slot_base&& src);
348352

349353
public: // public to avoid template friend declarations
350354
/** Typed slot_rep object that contains a functor. */

sigc++/signal_base.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ signal_base::signal_base(const signal_base& src)
167167
impl_->reference();
168168
}
169169

170-
signal_base::signal_base(signal_base&& src) noexcept
170+
signal_base::signal_base(signal_base&& src)
171171
: trackable(std::move(src)),
172172
impl_(std::move(src.impl_))
173173
{
@@ -248,7 +248,7 @@ signal_base& signal_base::operator=(const signal_base& src)
248248
return *this;
249249
}
250250

251-
signal_base& signal_base::operator=(signal_base&& src) noexcept
251+
signal_base& signal_base::operator=(signal_base&& src)
252252
{
253253
if (src.impl_ == impl_) return *this;
254254

sigc++/signal_base.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ struct SIGC_API signal_base : public trackable
290290

291291
signal_base(const signal_base& src);
292292

293-
signal_base(signal_base&& src) noexcept;
293+
signal_base(signal_base&& src);
294294

295295
~signal_base();
296296

297297
signal_base& operator=(const signal_base& src);
298298

299-
signal_base& operator=(signal_base&& src) noexcept;
299+
signal_base& operator=(signal_base&& src);
300300

301301
/** Returns whether the list of slots is empty.
302302
* @return @p true if the list of slots is empty.

sigc++/trackable.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ trackable::trackable(const trackable& /*src*/)
4343
//
4444
// If trackable's move constructor is modified, check if Glib::Object's
4545
// move constructor should be modified similarly.
46-
trackable::trackable(trackable&& src) noexcept
46+
trackable::trackable(trackable&& src)
4747
: callback_list_(nullptr)
4848
{
4949
src.notify_callbacks();
@@ -57,7 +57,7 @@ trackable& trackable::operator=(const trackable& src)
5757
return *this;
5858
}
5959

60-
trackable& trackable::operator=(trackable&& src) noexcept
60+
trackable& trackable::operator=(trackable&& src)
6161
{
6262
if(this != &src)
6363
{

sigc++/trackable.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,20 @@ struct SIGC_API trackable_callback_list
108108
*/
109109
struct SIGC_API trackable
110110
{
111+
// Concerning noexcept specifications:
112+
// libsigc++ does not have complete control of what happens when notify_callbacks()
113+
// is called. It may throw an exception. A method that calls notify_callbacks()
114+
// shall not be declared noexcept.
115+
111116
trackable();
112117

113118
trackable(const trackable& src);
114119

115-
trackable(trackable&& src) noexcept;
120+
trackable(trackable&& src);
116121

117122
trackable& operator=(const trackable& src);
118123

119-
trackable& operator=(trackable&& src) noexcept;
124+
trackable& operator=(trackable&& src);
120125

121126
~trackable();
122127

0 commit comments

Comments
 (0)