From: Gabriel Corona Date: Tue, 24 Nov 2015 10:06:04 +0000 (+0100) Subject: [surf] Move the hostCreatedCallbacks after the constructor X-Git-Tag: v3_13~1561 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b3b8a3e821fc6fd4403ddf71cf9e2e09c03f7ce7 [surf] Move the hostCreatedCallbacks after the constructor The callbacks were called in the Host constructor which is at the very beginning og the object construction: the fields of the derived classes are not initialized at this point and the correct virtual methods are not available. --- diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 19b53bc988..227855f014 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -50,6 +50,7 @@ Host *HostCLM03Model::createHost(const char *name){ (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL), sg_host_edge(sg_host), sg_host_surfcpu(sg_host)); + surf_callback_emit(hostCreatedCallbacks, host); XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage)); xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host); return host; diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index 025df7c46d..3c79032a42 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -83,7 +83,6 @@ Host::Host(Model *model, const char *name, xbt_dict_t props, , p_storage(storage), p_netElm(netElm), p_cpu(cpu) { p_params.ramsize = 0; - surf_callback_emit(hostCreatedCallbacks, this); } Host::Host(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, @@ -92,7 +91,6 @@ Host::Host(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t co , p_storage(storage), p_netElm(netElm), p_cpu(cpu) { p_params.ramsize = 0; - surf_callback_emit(hostCreatedCallbacks, this); } Host::~Host(){ diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index 0c5645abbf..2114c977cd 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -277,7 +277,7 @@ Host *HostL07Model::createHost(const char *name) wk = new HostL07(this, name, NULL, sg_host_edge(sg_host), sg_host_surfcpu(sg_host)); - + surf_callback_emit(hostCreatedCallbacks, wk); xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, wk); return wk;