for(std::size_t i = 0; i < size; ++i)
{
- SlotConnection* connection = mConnections[i];
+ auto& connection = mConnections[i];
// Tell the signal that the slot is disconnected
- connection->GetSlotObserver()->SlotDisconnected(connection->GetCallback());
+ connection.GetSlotObserver()->SlotDisconnected(connection.GetCallback());
- delete connection;
}
mConnections.Clear();
void ConnectionTracker::SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
{
- SlotConnection* connection = new SlotConnection(slotObserver, callback);
- mConnections.PushBack(connection);
+ mConnections.PushBack(SlotConnection(slotObserver, callback));
}
void ConnectionTracker::SignalDisconnected(SlotObserver* signal, CallbackBase* callback)
for(std::size_t i = 0; i < size; ++i)
{
- SlotConnection* connection = mConnections[i];
+ auto& connection = mConnections[i];
// Pointer comparison i.e. SignalConnection contains pointer to same callback instance
- if(connection->GetCallback() == callback)
+ if(connection.GetCallback() == callback)
{
// Remove from connection list
mConnections.Erase(mConnections.Begin() + i);
- // Delete connection
- delete connection;
-
// Disconnection complete
return;
}
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/signals/connection-tracker-interface.h>
+#include <dali/public-api/signals/signal-slot-connections.h>
namespace Dali
{
ConnectionTracker& operator=(ConnectionTracker&&) = delete; ///< Deleted move assignment operator. @SINCE_1_9.25
private:
- Dali::Vector<SlotConnection*> mConnections; ///< Vector of connection pointers
+ Dali::Vector<SlotConnection> mConnections; ///< Vector of connection
};
/**