rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=a559f523bae0f629f379b416a1f58d4753cc091d
commit a559f523bae0f629f379b416a1f58d4753cc091d Author: Mykyta Biliavskyi <[email protected]> Date: Fri Aug 12 16:23:33 2016 +0300 Project manager: move save routine back into main thread. Using edje_edit_save API in another thread - cause undefined behaviour. --- src/bin/Makefile.am | 1 - src/bin/project_manager/project_manager.c | 16 +++-- src/bin/project_manager/project_manager_save.c | 86 -------------------------- 3 files changed, 10 insertions(+), 93 deletions(-) diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index c51c9f1..bd884f6 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -66,7 +66,6 @@ libete_a_SOURCES = \ ../../src/bin/project_manager/group_manager.c \ ../../src/bin/project_manager/project_manager.c \ ../../src/bin/project_manager/project_manager_open.c \ -../../src/bin/project_manager/project_manager_save.c \ ../../src/bin/project_manager/project_manager_import_edj.c \ ../../src/bin/project_manager/project_manager_import_edc.c \ ../../src/bin/project_manager/project_manager_export_resources.c \ diff --git a/src/bin/project_manager/project_manager.c b/src/bin/project_manager/project_manager.c index 2d7e1bf..9b88c76 100644 --- a/src/bin/project_manager/project_manager.c +++ b/src/bin/project_manager/project_manager.c @@ -472,12 +472,16 @@ pm_project_save(Project *project, ptd->func_end = func_end; ptd->data = (void *)data; ptd->project = project; - eina_lock_new(&ptd->mutex); - - /* Launch save project routine inside thread with feedback */ - ecore_thread_feedback_run(_project_save_feedback_job, _project_save_feedback_cb, - _project_save_end_cb, _project_save_cancel_cb, ptd, - true); + if (!editor_save_all(ptd->project->global_object)) + { + ERR("Failed to save project."); + ptd->result = PM_PROJECT_ERROR; + _end_send((void *)ptd); + return; + } + ecore_file_cp(ptd->project->dev, ptd->project->saved_edj); + ptd->result = PM_PROJECT_SUCCESS; + _end_send((void *)ptd); } Eina_Bool diff --git a/src/bin/project_manager/project_manager_save.c b/src/bin/project_manager/project_manager_save.c deleted file mode 100644 index ea28735..0000000 --- a/src/bin/project_manager/project_manager_save.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Efl Edje Theme Editor - * Copyright (C) 2013-2016 Samsung Electronics. - * - * This file is part of Edje Theme Editor. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; If not, see www.gnu.org/licenses/lgpl.html. - */ -#include "project_manager.h" -#include "project_manager_private.h" - -void -_project_save_cancel_cb(void *data, Ecore_Thread *th __UNUSED__) -{ - Project_Thread *ptd = (Project_Thread *)data; - ERR("Project saving process canceled"); - - ptd->result = PM_PROJECT_ERROR; - _end_send(ptd); -} - -void -_project_save_end_cb(void *data, Ecore_Thread *th __UNUSED__) -{ - Project_Thread *ptd = (Project_Thread *)data; - ptd->result = PM_PROJECT_SUCCESS; - _end_send(ptd); -} - -void -_project_save_feedback_cb(void *data, - Ecore_Thread *th __UNUSED__, - void *msg_data) -{ - Project_Thread *ptd = (Project_Thread *)data; - Eina_Stringshare *message = (Eina_Stringshare *)msg_data; - assert(message != NULL); - assert(ptd != NULL); - - ptd->func_progress(NULL, message); - eina_stringshare_del(message); -} - -void -_project_save_feedback_job(void *data, Ecore_Thread *th) -{ - Project_Thread *ptd = (Project_Thread *)data; - if (!eina_lock_take(&ptd->mutex)) - { - ERR("Failed access to the thread data"); - eina_lock_release(&ptd->mutex); - ecore_thread_cancel(th); - return; - } - - assert(ptd->project != NULL); - Eina_Stringshare *message = eina_stringshare_printf(_("Save project '%s'"), ptd->project->name); - ecore_thread_feedback(th, message); - - ecore_thread_main_loop_begin(); - if (!editor_save_all(ptd->project->global_object)) - { - ERR("Failed to save project."); - eina_lock_release(&ptd->mutex); - ecore_thread_cancel(th); - return; - } - ecore_thread_main_loop_end(); - ecore_file_cp(ptd->project->dev, ptd->project->saved_edj); - - message = eina_stringshare_printf(_("Save done.")); - ecore_thread_feedback(th, message); - - eina_lock_release(&ptd->mutex); - return; -} --
