mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
fix static init crash
This commit is contained in:
parent
c6816fa9b5
commit
6b3cc48bb6
@ -15,7 +15,7 @@
|
||||
#include "unicodeLatinMap.h"
|
||||
|
||||
bool UnicodeLatinMap::_initialized = false;
|
||||
UnicodeLatinMap::ByCharacter UnicodeLatinMap::_by_character;
|
||||
UnicodeLatinMap::ByCharacter *UnicodeLatinMap::_by_character;
|
||||
const UnicodeLatinMap::Entry *UnicodeLatinMap::_direct_chars[UnicodeLatinMap::max_direct_chars];
|
||||
|
||||
static const UnicodeLatinMap::Entry latin_map[] = {
|
||||
@ -1320,8 +1320,8 @@ look_up(wchar_t character) {
|
||||
|
||||
} else {
|
||||
ByCharacter::const_iterator ci;
|
||||
ci = _by_character.find(character);
|
||||
if (ci != _by_character.end()) {
|
||||
ci = _by_character->find(character);
|
||||
if (ci != _by_character->end()) {
|
||||
return (*ci).second;
|
||||
}
|
||||
return NULL;
|
||||
@ -1337,6 +1337,7 @@ look_up(wchar_t character) {
|
||||
void UnicodeLatinMap::
|
||||
init() {
|
||||
if (!_initialized) {
|
||||
_by_character = new ByCharacter;
|
||||
for (int i = 0; i < latin_map_length; i++) {
|
||||
const UnicodeLatinMap::Entry *entry = &latin_map[i];
|
||||
|
||||
@ -1346,7 +1347,7 @@ init() {
|
||||
if (entry->_character < max_direct_chars) {
|
||||
_direct_chars[entry->_character] = entry;
|
||||
} else {
|
||||
_by_character[entry->_character] = entry;
|
||||
(*_by_character)[entry->_character] = entry;
|
||||
}
|
||||
}
|
||||
_initialized = true;
|
||||
|
@ -134,7 +134,7 @@ private:
|
||||
static bool _initialized;
|
||||
|
||||
typedef phash_map<wchar_t, const Entry *, integer_hash<wchar_t> > ByCharacter;
|
||||
static ByCharacter _by_character;
|
||||
static ByCharacter *_by_character;
|
||||
enum { max_direct_chars = 256 };
|
||||
static const Entry *_direct_chars[max_direct_chars];
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user