diff --git a/f8/jsonhttprequest.cc b/f8/jsonhttprequest.cc index 1296a50..88b9694 100644 --- a/f8/jsonhttprequest.cc +++ b/f8/jsonhttprequest.cc @@ -8,14 +8,14 @@ namespace f8 { + JsonHttpRequest::JsonHttpRequest() { - resp_xobj = a8::MutableXObject::NewObject(); + resp_xobj = a8::MutableXObject::CreateObject(); } JsonHttpRequest::~JsonHttpRequest() { - delete resp_xobj; if (context && free_context) { free_context(context); } diff --git a/f8/jsonhttprequest.h b/f8/jsonhttprequest.h index 3e4c017..59a77de 100644 --- a/f8/jsonhttprequest.h +++ b/f8/jsonhttprequest.h @@ -17,7 +17,7 @@ namespace f8 time_t handle_time = 0; std::string query_str; a8::XObject request; - a8::MutableXObject* resp_xobj = nullptr; + std::shared_ptr resp_xobj; int async_pending_count = 0; void* context = nullptr; diff --git a/f8/tglog.cc b/f8/tglog.cc index fc549fc..46d7aa0 100644 --- a/f8/tglog.cc +++ b/f8/tglog.cc @@ -205,7 +205,7 @@ namespace f8 strftime(buff, a8::ArraySize(buff), "%F %T", &tm_time); logtime_str.append((char*)buff); } - a8::MutableXObject* xobj = a8::MutableXObject::NewObject(); + auto xobj = a8::MutableXObject::CreateObject(); xobj->SetVal("#account_id", accountid); xobj->SetVal("#type", "track"); @@ -232,8 +232,6 @@ namespace f8 impl_->save_cond->notify_all(); } } - delete xobj; - xobj = nullptr; } }