fix for #9045
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,6 +66,8 @@
|
|||||||
|
|
||||||
// includes Mac headers
|
// includes Mac headers
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
#include "wx/thread.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -2800,10 +2802,12 @@ public:
|
|||||||
#else
|
#else
|
||||||
ubuf = (UniChar*) (buf ? buf : tbuf) ;
|
ubuf = (UniChar*) (buf ? buf : tbuf) ;
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
wxMutexLocker lock( m_MB2WC_guard );
|
||||||
status = TECConvertText(
|
status = TECConvertText(
|
||||||
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
|
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
|
||||||
(TextPtr) ubuf, byteBufferLen, &byteOutLen);
|
(TextPtr) ubuf, byteBufferLen, &byteOutLen);
|
||||||
|
}
|
||||||
|
|
||||||
#if SIZEOF_WCHAR_T == 4
|
#if SIZEOF_WCHAR_T == 4
|
||||||
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar
|
// we have to terminate here, because n might be larger for the trailing zero, and if UniChar
|
||||||
@@ -2854,9 +2858,12 @@ public:
|
|||||||
ubuf = (UniChar*) psz ;
|
ubuf = (UniChar*) psz ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
wxMutexLocker lock( m_WC2MB_guard );
|
||||||
status = TECConvertText(
|
status = TECConvertText(
|
||||||
m_WC2MB_converter, (ConstTextPtr) ubuf, byteInLen, &byteInLen,
|
m_WC2MB_converter, (ConstTextPtr) ubuf, byteInLen, &byteInLen,
|
||||||
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
|
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
|
||||||
|
}
|
||||||
|
|
||||||
#if SIZEOF_WCHAR_T == 4
|
#if SIZEOF_WCHAR_T == 4
|
||||||
free( ubuf ) ;
|
free( ubuf ) ;
|
||||||
@@ -2899,6 +2906,9 @@ protected :
|
|||||||
mutable TECObjectRef m_MB2WC_converter;
|
mutable TECObjectRef m_MB2WC_converter;
|
||||||
mutable TECObjectRef m_WC2MB_converter;
|
mutable TECObjectRef m_WC2MB_converter;
|
||||||
|
|
||||||
|
mutable wxMutex m_MB2WC_guard;
|
||||||
|
mutable wxMutex m_WC2MB_guard;
|
||||||
|
|
||||||
TextEncodingBase m_char_encoding;
|
TextEncodingBase m_char_encoding;
|
||||||
TextEncodingBase m_unicode_encoding;
|
TextEncodingBase m_unicode_encoding;
|
||||||
};
|
};
|
||||||
@@ -2958,6 +2968,8 @@ public :
|
|||||||
ByteCount dcubufread , dcubufwritten ;
|
ByteCount dcubufread , dcubufwritten ;
|
||||||
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
|
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
|
||||||
|
|
||||||
|
{
|
||||||
|
wxMutexLocker lock( m_WC2MB_guard );
|
||||||
ConvertFromUnicodeToText( m_uni , byteInLen , ubuf ,
|
ConvertFromUnicodeToText( m_uni , byteInLen , ubuf ,
|
||||||
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , dcubuf ) ;
|
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , dcubuf ) ;
|
||||||
|
|
||||||
@@ -2966,6 +2978,7 @@ public :
|
|||||||
status = TECConvertText(
|
status = TECConvertText(
|
||||||
m_WC2MB_converter, (ConstTextPtr) dcubuf, dcubufwritten, &dcubufread,
|
m_WC2MB_converter, (ConstTextPtr) dcubuf, dcubufwritten, &dcubufread,
|
||||||
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
|
(TextPtr) (buf ? buf : tbuf), byteBufferLen, &byteOutLen);
|
||||||
|
}
|
||||||
|
|
||||||
free( dcubuf );
|
free( dcubuf );
|
||||||
|
|
||||||
@@ -3015,6 +3028,8 @@ public :
|
|||||||
ByteCount dcubufread , dcubufwritten ;
|
ByteCount dcubufread , dcubufwritten ;
|
||||||
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
|
UniChar *dcubuf = (UniChar*) malloc( dcubuflen ) ;
|
||||||
|
|
||||||
|
{
|
||||||
|
wxMutexLocker lock( m_MB2WC_guard );
|
||||||
status = TECConvertText(
|
status = TECConvertText(
|
||||||
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
|
m_MB2WC_converter, (ConstTextPtr) psz, byteInLen, &byteInLen,
|
||||||
(TextPtr) dcubuf, dcubuflen, &byteOutLen);
|
(TextPtr) dcubuf, dcubuflen, &byteOutLen);
|
||||||
@@ -3025,6 +3040,7 @@ public :
|
|||||||
// now from the decomposed UniChar to properly composed uniChar
|
// now from the decomposed UniChar to properly composed uniChar
|
||||||
ConvertFromUnicodeToText( m_uniBack , byteOutLen , dcubuf ,
|
ConvertFromUnicodeToText( m_uniBack , byteOutLen , dcubuf ,
|
||||||
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , ubuf ) ;
|
kUnicodeDefaultDirectionMask, 0, NULL, NULL, NULL, dcubuflen , &dcubufread , &dcubufwritten , ubuf ) ;
|
||||||
|
}
|
||||||
|
|
||||||
free( dcubuf );
|
free( dcubuf );
|
||||||
byteOutLen = dcubufwritten ;
|
byteOutLen = dcubufwritten ;
|
||||||
|
Reference in New Issue
Block a user