Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make it possible to destroy a VM that is already half-destroyed
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 31 May 2017 15:39:48 +0000 (17:39 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 31 May 2017 15:39:48 +0000 (17:39 +0200)
src/msg/msg_vm.cpp
src/plugins/vm/s4u_VirtualMachine.cpp

index 4ba7663..d7c829e 100644 (file)
@@ -58,7 +58,8 @@ void MSG_vm_get_params(msg_vm_t vm, vm_params_t params)
 /* **** Check state of a VM **** */
 static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state)
 {
 /* **** Check state of a VM **** */
 static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state)
 {
-  return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getState() == state;
+  simgrid::s4u::VirtualMachine* castedVm = static_cast<simgrid::s4u::VirtualMachine*>(vm);
+  return castedVm->pimpl_vm_ != nullptr && castedVm->pimpl_vm_->getState() == state;
 }
 
 /** @brief Returns whether the given VM has just created, not running.
 }
 
 /** @brief Returns whether the given VM has just created, not running.
index 3400a3b..31c984a 100644 (file)
@@ -56,7 +56,7 @@ VirtualMachine::~VirtualMachine()
 
 bool VirtualMachine::isMigrating()
 {
 
 bool VirtualMachine::isMigrating()
 {
-  return pimpl_vm_->isMigrating;
+  return pimpl_vm_ && pimpl_vm_->isMigrating;
 }
 double VirtualMachine::getRamsize()
 {
 }
 double VirtualMachine::getRamsize()
 {