|
@@ -166,6 +166,7 @@ struct card:card_location_base
|
|
loc_tool_main one_ct_message_handle::m_loc_tool;
|
|
loc_tool_main one_ct_message_handle::m_loc_tool;
|
|
struct card_list_impl:card_list
|
|
struct card_list_impl:card_list
|
|
{
|
|
{
|
|
|
|
+ static card_list_impl*_impl;
|
|
std::vector<card*> m_list;
|
|
std::vector<card*> m_list;
|
|
card_list_impl()
|
|
card_list_impl()
|
|
{
|
|
{
|
|
@@ -200,9 +201,22 @@ struct card_list_impl:card_list
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+card_list_impl *card_list_impl::_impl=nullptr;
|
|
|
|
+std::mutex _card_list_impl_mutex;
|
|
card_list *card_list::instance()
|
|
card_list *card_list::instance()
|
|
{
|
|
{
|
|
- static card_list_impl _impl;
|
|
|
|
- return &_impl;
|
|
|
|
|
|
+ if(card_list_impl::_impl!=nullptr)
|
|
|
|
+ {
|
|
|
|
+ return card_list_impl::_impl;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::unique_lock<std::mutex> lock(_card_list_impl_mutex);
|
|
|
|
+
|
|
|
|
+ if(card_list_impl::_impl==nullptr)
|
|
|
|
+ {
|
|
|
|
+ card_list_impl::_impl=new card_list_impl();
|
|
|
|
+ card_list_impl::_impl->init_card_from_db();
|
|
|
|
+ }
|
|
|
|
+ return card_list_impl::_impl;
|
|
}
|
|
}
|
|
|
|
|