FIX:fixed studio crash caused by HTTP request blocking
jira:[STUDIO-3849] Change-Id: I6348af96014e80da6b720da48239fed262f0f3c5
This commit is contained in:
parent
c144d4e7d6
commit
44eaa75110
|
@ -192,6 +192,8 @@ public:
|
||||||
static BBLSubTask::SubTaskStatus parse_user_service_task_status(int status);
|
static BBLSubTask::SubTaskStatus parse_user_service_task_status(int status);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::function<void(BBLModelTask* subtask)> OnGetSubTaskFn;
|
||||||
|
|
||||||
class BBLTask {
|
class BBLTask {
|
||||||
public:
|
public:
|
||||||
enum TaskStatus {
|
enum TaskStatus {
|
||||||
|
|
|
@ -2621,6 +2621,11 @@ void StatusPanel::update_basic_print_data(bool def)
|
||||||
|
|
||||||
void StatusPanel::update_model_info()
|
void StatusPanel::update_model_info()
|
||||||
{
|
{
|
||||||
|
auto get_subtask_fn = [this](BBLModelTask* subtask) {
|
||||||
|
obj->set_modeltask(subtask);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (wxGetApp().getAgent() && obj) {
|
if (wxGetApp().getAgent() && obj) {
|
||||||
|
|
||||||
BBLSubTask* curr_task = obj->get_subtask();
|
BBLSubTask* curr_task = obj->get_subtask();
|
||||||
|
@ -2629,11 +2634,7 @@ void StatusPanel::update_model_info()
|
||||||
if (!curr_model_task) {
|
if (!curr_model_task) {
|
||||||
curr_model_task = new BBLModelTask();
|
curr_model_task = new BBLModelTask();
|
||||||
curr_model_task->task_id = curr_task->task_id;
|
curr_model_task->task_id = curr_task->task_id;
|
||||||
int result = wxGetApp().getAgent()->get_subtask(curr_model_task);
|
wxGetApp().getAgent()->get_subtask(curr_model_task, get_subtask_fn);
|
||||||
|
|
||||||
if (result > -1) {
|
|
||||||
obj->set_modeltask(curr_model_task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ struct ScoreData
|
||||||
std::unordered_map<wxString, std::string> local_to_url_image;
|
std::unordered_map<wxString, std::string> local_to_url_image;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::function<void(BBLModelTask* subtask)> OnGetSubTaskFn;
|
||||||
|
|
||||||
class ScoreDialog : public GUI::DPIDialog
|
class ScoreDialog : public GUI::DPIDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1194,11 +1194,11 @@ int NetworkAgent::get_model_publish_url(std::string* url)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkAgent::get_subtask(BBLModelTask* task)
|
int NetworkAgent::get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (network_agent && get_subtask_ptr) {
|
if (network_agent && get_subtask_ptr) {
|
||||||
ret = get_subtask_ptr(network_agent, task);
|
ret = get_subtask_ptr(network_agent, task, getsub_fn);
|
||||||
if (ret)
|
if (ret)
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ typedef int (*func_get_design_staffpick)(void *agent, int offset, int limit, std
|
||||||
typedef int (*func_start_pubilsh)(void *agent, PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
|
typedef int (*func_start_pubilsh)(void *agent, PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
|
||||||
typedef int (*func_get_profile_3mf)(void *agent, BBLProfile* profile);
|
typedef int (*func_get_profile_3mf)(void *agent, BBLProfile* profile);
|
||||||
typedef int (*func_get_model_publish_url)(void *agent, std::string* url);
|
typedef int (*func_get_model_publish_url)(void *agent, std::string* url);
|
||||||
typedef int (*func_get_subtask)(void *agent, BBLModelTask* task);
|
typedef int (*func_get_subtask)(void *agent, BBLModelTask* task, OnGetSubTaskFn getsub_fn);
|
||||||
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
|
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
|
||||||
typedef int (*func_get_model_mall_detail_url)(void *agent, std::string* url, std::string id);
|
typedef int (*func_get_model_mall_detail_url)(void *agent, std::string* url, std::string id);
|
||||||
typedef int (*func_get_my_profile)(void *agent, std::string token, unsigned int *http_code, std::string *http_body);
|
typedef int (*func_get_my_profile)(void *agent, std::string token, unsigned int *http_code, std::string *http_body);
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
|
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
|
||||||
int get_profile_3mf(BBLProfile* profile);
|
int get_profile_3mf(BBLProfile* profile);
|
||||||
int get_model_publish_url(std::string* url);
|
int get_model_publish_url(std::string* url);
|
||||||
int get_subtask(BBLModelTask* task);
|
int get_subtask(BBLModelTask* task, OnGetSubTaskFn getsub_fn);
|
||||||
int get_model_mall_home_url(std::string* url);
|
int get_model_mall_home_url(std::string* url);
|
||||||
int get_model_mall_detail_url(std::string* url, std::string id);
|
int get_model_mall_detail_url(std::string* url, std::string id);
|
||||||
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body);
|
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body);
|
||||||
|
|
Loading…
Reference in New Issue