/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const int INVALID_CALLBACK_INDEX = -1;
-// Predicate for std::remove_if algorithm
-bool IsNullPredicate(void* ptr)
-{
- return ptr == NULL;
-}
-
} // unnamed namespace
namespace Dali
// only do something if there are items
if( total > 0 )
{
- std::size_t removed = 0;
+ std::size_t index = 0;
+ // process the whole vector
for( std::size_t i = 0; i < total; ++i )
{
- if( mSignalConnections[ i ] == NULL )
+ if( mSignalConnections[ index ] == NULL )
+ {
+ // items will be moved so don't increase index (erase will decrease the count of vector)
+ mSignalConnections.Erase( mSignalConnections.Begin() + index );
+ }
+ else
{
- ++removed;
- // swaps it to the end
- mSignalConnections.Remove( mSignalConnections.Begin() + i );
+ // increase to next element
+ ++index;
}
}
- // dont reallocate memory, just resize vector
- mSignalConnections.Resize( total - removed );
}
}
else
{
// mFlag is NULL when Emit() is called during Emit()
- DALI_LOG_ERROR( "Cannot call Emit() from inside Emit()" );
+ DALI_LOG_ERROR( "Cannot call Emit() from inside Emit()\n" );
}
}