Loading

Paste #pxkpq7bth

  1. Index: src/script/api/script_testmode.cpp
  2. ===================================================================
  3. --- src/script/api/script_testmode.cpp  (revision 27378)
  4. +++ src/script/api/script_testmode.cpp  (working copy)
  5. @@ -30,7 +30,7 @@
  6.     this->SetDoCommandMode(&ScriptTestMode::ModeProc, this);
  7.  }
  8.  
  9. -ScriptTestMode::~ScriptTestMode()
  10. +void ScriptTestMode::FinalRelease()
  11.  {
  12.     if (this->GetDoCommandModeInstance() != this) {
  13.         /* Ignore this error if the script already died. */
  14. @@ -38,5 +38,9 @@
  15.             throw Script_FatalError("Testmode object was removed while it was not the latest *Mode object created.");
  16.         }
  17.     }
  18. +}
  19. +
  20. +ScriptTestMode::~ScriptTestMode()
  21. +{
  22.     this->SetDoCommandMode(this->last_mode, this->last_instance);
  23.  }
  24. Index: src/script/api/script_execmode.cpp
  25. ===================================================================
  26. --- src/script/api/script_execmode.cpp  (revision 27378)
  27. +++ src/script/api/script_execmode.cpp  (working copy)
  28. @@ -30,7 +30,7 @@
  29.     this->SetDoCommandMode(&ScriptExecMode::ModeProc, this);
  30.  }
  31.  
  32. -ScriptExecMode::~ScriptExecMode()
  33. +void ScriptExecMode::FinalRelease()
  34.  {
  35.     if (this->GetDoCommandModeInstance() != this) {
  36.         /* Ignore this error if the script already died. */
  37. @@ -38,5 +38,9 @@
  38.             throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
  39.         }
  40.     }
  41. +}
  42. +
  43. +ScriptExecMode::~ScriptExecMode()
  44. +{
  45.     this->SetDoCommandMode(this->last_mode, this->last_instance);
  46.  }
  47. Index: src/script/api/script_testmode.hpp
  48. ===================================================================
  49. --- src/script/api/script_testmode.hpp  (revision 27378)
  50. +++ src/script/api/script_testmode.hpp  (working copy)
  51. @@ -48,6 +48,8 @@
  52.      *   in when the instance was created.
  53.      */
  54.     ~ScriptTestMode();
  55. +
  56. +   virtual void FinalRelease();
  57.  };
  58.  
  59.  #endif /* SCRIPT_TESTMODE_HPP */
  60. Index: src/script/api/script_execmode.hpp
  61. ===================================================================
  62. --- src/script/api/script_execmode.hpp  (revision 27378)
  63. +++ src/script/api/script_execmode.hpp  (working copy)
  64. @@ -46,6 +46,8 @@
  65.      *   in when the instance was created.
  66.      */
  67.     ~ScriptExecMode();
  68. +
  69. +   virtual void FinalRelease();
  70.  };
  71.  
  72.  #endif /* SCRIPT_EXECMODE_HPP */
  73. Index: src/misc/countedobj.cpp
  74. ===================================================================
  75. --- src/misc/countedobj.cpp (revision 27378)
  76. +++ src/misc/countedobj.cpp (working copy)
  77. @@ -25,7 +25,12 @@
  78.     int32 res = --m_ref_cnt;
  79.     assert(res >= 0);
  80.     if (res == 0) {
  81. -       FinalRelease();
  82. +       try {
  83. +           FinalRelease();
  84. +       } catch (...) {
  85. +           delete this;
  86. +           throw;
  87. +       }
  88.         delete this;
  89.     }
  90.     return res;
  91.  

Comments