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"
|
#include "unicodeLatinMap.h"
|
||||||
|
|
||||||
bool UnicodeLatinMap::_initialized = false;
|
bool UnicodeLatinMap::_initialized = false;
|
||||||
UnicodeLatinMap::ByCharacter UnicodeLatinMap::_by_character;
|
UnicodeLatinMap::ByCharacter *UnicodeLatinMap::_by_character;
|
||||||
const UnicodeLatinMap::Entry *UnicodeLatinMap::_direct_chars[UnicodeLatinMap::max_direct_chars];
|
const UnicodeLatinMap::Entry *UnicodeLatinMap::_direct_chars[UnicodeLatinMap::max_direct_chars];
|
||||||
|
|
||||||
static const UnicodeLatinMap::Entry latin_map[] = {
|
static const UnicodeLatinMap::Entry latin_map[] = {
|
||||||
@ -1320,8 +1320,8 @@ look_up(wchar_t character) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
ByCharacter::const_iterator ci;
|
ByCharacter::const_iterator ci;
|
||||||
ci = _by_character.find(character);
|
ci = _by_character->find(character);
|
||||||
if (ci != _by_character.end()) {
|
if (ci != _by_character->end()) {
|
||||||
return (*ci).second;
|
return (*ci).second;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1337,6 +1337,7 @@ look_up(wchar_t character) {
|
|||||||
void UnicodeLatinMap::
|
void UnicodeLatinMap::
|
||||||
init() {
|
init() {
|
||||||
if (!_initialized) {
|
if (!_initialized) {
|
||||||
|
_by_character = new ByCharacter;
|
||||||
for (int i = 0; i < latin_map_length; i++) {
|
for (int i = 0; i < latin_map_length; i++) {
|
||||||
const UnicodeLatinMap::Entry *entry = &latin_map[i];
|
const UnicodeLatinMap::Entry *entry = &latin_map[i];
|
||||||
|
|
||||||
@ -1346,7 +1347,7 @@ init() {
|
|||||||
if (entry->_character < max_direct_chars) {
|
if (entry->_character < max_direct_chars) {
|
||||||
_direct_chars[entry->_character] = entry;
|
_direct_chars[entry->_character] = entry;
|
||||||
} else {
|
} else {
|
||||||
_by_character[entry->_character] = entry;
|
(*_by_character)[entry->_character] = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
@ -134,7 +134,7 @@ private:
|
|||||||
static bool _initialized;
|
static bool _initialized;
|
||||||
|
|
||||||
typedef phash_map<wchar_t, const Entry *, integer_hash<wchar_t> > ByCharacter;
|
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 };
|
enum { max_direct_chars = 256 };
|
||||||
static const Entry *_direct_chars[max_direct_chars];
|
static const Entry *_direct_chars[max_direct_chars];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user