This patch fixes the bug related to unregisterModels ().
The original codes just clear a model vector structure,
which was supposed to call unsetModel() per each model.
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
int
HostHandler::unregisterModels ()
{
- models_.clear ();
+ std::function <bool (Model *)> functor =
+ [&] (Model *m) -> bool {
+ bool can_remove = true;
+ int status = device_->unsetModel (m);
+ if (status != 0) {
+ logwarn (TAG, "Failed to unset model: %d\n", status);
+ can_remove = false;
+ }
+ return can_remove;
+ };
+
+ models_.for_each (functor);
return 0;
}