ExcMessage("You can't move a smart pointer object that "
"is pointing to an object that is no longer alive."));
- t->subscribe(&pointed_to_object_is_alive, id);
+ try
+ {
+ t->subscribe(&pointed_to_object_is_alive, id);
+ }
+ catch (...)
+ {
+ Assert(false,
+ ExcMessage(
+ "Calling subscribe() failed with an exception, but we "
+ "are in a function that cannot throw exceptions. "
+ "Aborting the program here."));
+ }
// Release the rhs object as if we had moved all members away from
// it directly:
else if (&tt != this)
{
// Let us unsubscribe from the current object
- if (pointed_to_object_is_alive)
+ if (t != nullptr && pointed_to_object_is_alive)
t->unsubscribe(&pointed_to_object_is_alive, id);
// Then reset to the new object, and subscribe to it:
ExcMessage("You can't move a smart pointer object that "
"is pointing to an object that is no longer alive."));
t = tt.get();
- t->subscribe(&pointed_to_object_is_alive, id);
+ try
+ {
+ t->subscribe(&pointed_to_object_is_alive, id);
+ }
+ catch (...)
+ {
+ Assert(false,
+ ExcMessage(
+ "Calling subscribe() failed with an exception, but we "
+ "are in a function that cannot throw exceptions. "
+ "Aborting the program here."));
+ }
// Finally release the rhs object since we moved its contents
tt = nullptr;