- Temporary workaround for the "Second Bug", caused by a reset in the middle of a request editing operation which should be atomic. Though I think it should be fixed in the backend...

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1003 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
elvez 2006-09-03 00:25:22 +00:00
parent c10ed2f4fb
commit 5242b37e13
1 changed files with 23 additions and 0 deletions

View File

@ -515,6 +515,8 @@ SchedulablesTreeWidget::_on_add_request()
void
SchedulablesTreeWidget::_on_edit_request()
{
using std::vector;
RefPtr<Xml> glade(Xml::create(GLADEDIR "/add-request-dialog.glade"));
AddRequestDialog* add_request_dialog;
@ -524,6 +526,27 @@ SchedulablesTreeWidget::_on_edit_request()
Request* r = get_selected<Request>();
assert(r != NULL);
// FIXME: write more polite code for doing this, and probably using the same logic
// for all other editing operations may be useful for making the app more robust
const Environment::Processes& processes =
Simulation::get_instance().get_history().get_environment_at(0).get_processes();
for(Iseq<Environment::Processes::const_iterator> pit = const_iseq(processes); pit; ++pit)
{
vector<Thread*> threads = (*pit)->get_threads();
for(Iseq<vector<Thread*>::iterator> tit = iseq(threads); tit; ++tit)
{
vector<Request*> requests = (*tit)->get_requests();
for(Iseq<vector<Request*>::iterator> rit = iseq(requests); rit; ++rit)
{
if(*(*rit) == *r)
r = *rit;
}
}
}
add_request_dialog->run_edit(*r);
}