mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Fixed: Linux crash on shutdown
Many thanks to Nando for hunting this bug down. Statically initializing flyweight objects before they are used. Prevets an hard-to-detect crash on NPC ai destructor (after calling last destructor).
This commit is contained in:
parent
b5c6e6cf55
commit
f184f5c6f5
4 changed files with 31 additions and 4 deletions
|
|
@ -2,9 +2,14 @@
|
|||
<ESCRIPT>
|
||||
<header>
|
||||
<topic>Latest Core Changes</topic>
|
||||
<datemodified>12-26-2015</datemodified>
|
||||
<datemodified>12-27-2015</datemodified>
|
||||
</header>
|
||||
<version name="POL099">
|
||||
<entry>
|
||||
<date>12-27-2015</date>
|
||||
<author>Bodom & Nando:</author>
|
||||
<change type="Fixed">Linux crash on shutdown</change>
|
||||
</entry>
|
||||
<entry>
|
||||
<date>12-26-2015</date>
|
||||
<author>Bodom:</author>
|
||||
|
|
@ -118,8 +123,8 @@ were called twice on death and in the wrong order</change>
|
|||
<entry>
|
||||
<date>09-24-2015</date>
|
||||
<author>Bodom:</author>
|
||||
<change>Added New keyword AttackCProp on npcdesc.cfg allows defining CProps for<br/>
|
||||
intrinsic weapons.</change>
|
||||
<change type="Added">New keyword AttackCProp on npcdesc.cfg allows defining CProps for<br/>
|
||||
intrinsic weapons.</change>
|
||||
<change type="Fixed">Hp/MaxHp updates to nearby clients were still using the real value<br/>
|
||||
instead of the 1000-based ratio when sending the 0xa1 packet.</change>
|
||||
<change type="Fixed">Hp/MaxHp updates were sent twice to the originating character.</change>
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ namespace Pol {
|
|||
#endif
|
||||
|
||||
// definition of the different Flyweight factories
|
||||
// WARNING: do not forget to add new types to struct flyweight_initializers
|
||||
struct cprop_name_tag {};
|
||||
typedef boost::flyweight<std::string, boost::flyweights::tag<cprop_name_tag>, FLYWEIGHT_HASH_FACTORY> cprop_name_flystring;
|
||||
struct cprop_value_tag {};
|
||||
|
|
@ -159,6 +160,22 @@ namespace Pol {
|
|||
typedef boost::flyweight<std::string, boost::flyweights::tag<npctemplate_name_tag>, FLYWEIGHT_HASH_FACTORY> npctemplate_name_flystring;
|
||||
struct function_name_tag {};
|
||||
typedef boost::flyweight<std::string, boost::flyweights::tag<function_name_tag>, FLYWEIGHT_HASH_FACTORY> function_name_flystring;
|
||||
|
||||
/**
|
||||
* These types must be initialized before any static objects using them
|
||||
* are initialized. Prevents a crash on exit after last destructor is called
|
||||
* because boost::flyweights initialization is not thread safe.
|
||||
*/
|
||||
struct flyweight_initializers {
|
||||
cprop_name_flystring::initializer fwInit_cprop_name;
|
||||
cprop_value_flystring::initializer fwInit_cprop_value;
|
||||
cfg_key_flystring::initializer fwInit_cfg_key;
|
||||
object_name_flystring::initializer fwInit_obj_name;
|
||||
script_name_flystring::initializer fwInit_script_name;
|
||||
npctemplate_name_flystring::initializer fwInit_npctemplate_name;
|
||||
function_name_flystring::initializer fwInit_func_name;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
-- POL099 --
|
||||
12-27-2015 Bodom & Nando:
|
||||
Fixed: Linux crash on shutdown
|
||||
12-26-2015 Bodom:
|
||||
Fixed: Bug in String.format()
|
||||
String tags were not correctly processed.
|
||||
|
|
@ -68,7 +70,7 @@
|
|||
Added: On pop-up menu request (single click) "misc/popupmenu.ecl" is called.
|
||||
Fixed: When using MapDiff, tiles could disappear in some circumstances
|
||||
09-24-2015 Bodom:
|
||||
Added New keyword AttackCProp on npcdesc.cfg allows defining CProps for
|
||||
Added: New keyword AttackCProp on npcdesc.cfg allows defining CProps for
|
||||
intrinsic weapons.
|
||||
Fixed: Hp/MaxHp updates to nearby clients were still using the real value
|
||||
instead of the 1000-based ratio when sending the 0xa1 packet.
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ Notes
|
|||
namespace Pol {
|
||||
namespace Core {
|
||||
|
||||
// See comment in boost_utils::flyweight_initializers
|
||||
boost_utils::flyweight_initializers fw_inits;
|
||||
|
||||
GameState gamestate;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue