Kaydet (Commit) 29dd2977 authored tarafından Chris Sherlock's avatar Chris Sherlock

vcl: fdo#86307 removed Solaris workaround from #i64273#

Basically, they were working around issues with XmbTextListToTextProperty
returning garbage characters, which showed on window titles.

The comment in the code is far more informative than the bug report:

 /* #i64273# there are some weird cases when using IIIMP on Solaris
    where for unknown reasons XmbTextListToTextProperty results in
    garbage. Test one string once to ensure safety.

    FIXME: This must be a bug in xiiimp.so.2 somewhere. However
    it was not possible to recreate this in a small sample program.
    This reeks of memory corruption somehow.
 */

Now I did a bit of research (aka "Google search") and discovered #i6759#
which was logged in 2002. This shows that the codebase was using __XOpenIM
in xiimp.so.2, which probably caused this issue. From the bug:

    I've tried to look into this problem and have found out, that
    apparently the
    use of the '__XOpenIM' subroutine from the
    /usr/openwin/lib/locale/common/xiiimp.so.2
    shared library causes this problem.  When running on Solaris, OO tries to
    dlopen() the above mentioned shared library, looks up the  '__XOpenIM'
    symbol in it and calls this function ( function XvaOpenIM() in file
    vcl/unx/source/app/i18n_wrp.cxx ).

    There's alternate code in OO that just calls the X11 documented function
    'XOpenIM()' instead.  This is enabled by running OO 1.0.x with the
    environment variable USE_XOPENIM defined to some value.  When running
    OO with

      env USE_XOPENIM=1 ~/OpenOffice.org1.0.1/soffice

    the problem does *not* occur any more and xprop for the same two windows
    mentioned in the initial bug report shows:

    % xprop |egrep '_NAME|_LOCALE'
    WM_LOCALE_NAME(STRING) = "de_DE..ISO8859-15"
    WM_ICON_NAME(STRING) = "unbenannt1 - OpenOffice.org 1.0.1 "
    WM_NAME(STRING) = "unbenannt1 - OpenOffice.org 1.0.1 "

    % xprop | egrep '_NAME|_LOCALE'
    WM_LOCALE_NAME(STRING) = "de_DE..ISO8859-15"
    WM_ICON_NAME(STRING) = "Umbruch einfÿ77777774gen"
    WM_NAME(STRING) = "Umbruch einfÿ77777774gen"

    As far as I can tell, the use of '__XOpenIM' frees some memory inside the
    Solaris X11 shared library that is still in use by the X11 character set
    conversion routines. Or in other words: the X11 character set conversion
    routines operate on freed memory, after __XOpenIM was called.

    These character set conversion routines are used by
    XmbTextListToTextProperty
    ( in WMAdaptor::setWMName() in file vcl/unx/source/app/wmadaptor.cxx ) and
    it seems they still access memory that was freed by the use of
    '__XOpenIM'.

Now later on, Caolan removed XvaOpenIM() in commit
4d6dab2c and then later committed a patch that
removed the ability to use the environment variable USE_XOPENIM as it wasn't
necessary anymore (commit: 8b028754). I'd say
that this was probably fixed in one of these changes.

Change-Id: I20effd77e0cdcde26d1be756cc6231f30f35118e
üst 28effca6
......@@ -997,41 +997,6 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const
}
static bool bTrustXmb = true;
#ifdef SOLARIS
/* #i64273# there are some weird cases when using IIIMP on Solaris
* where for unknown reasons XmbTextListToTextProperty results in
* garbage. Test one string once to ensure safety.
*
* FIXME: This must be a bug in xiiimp.so.2 somewhere. However
* it was not possible to recreate this in a small sample program.
* This reeks of memory corruption somehow.
*/
static bool bOnce = true;
if( bOnce )
{
bOnce = false;
XTextProperty aTestProp = { NULL, None, 0, 0 };
const char *pText = "trustme";
char* pT = const_cast<char*>(pText);
XmbTextListToTextProperty( m_pDisplay,
&pT,
1,
XStdICCTextStyle,
&aTestProp );
bTrustXmb = (aTestProp.nitems == 7) &&
(aTestProp.value != NULL ) &&
(strncmp( (char*)aTestProp.value, pText, 7 ) == 0) &&
(aTestProp.encoding == XA_STRING);
if( aTestProp.value )
XFree( aTestProp.value );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "%s\n",
bTrustXmb ?
"XmbTextListToTextProperty seems to work" :
"XmbTextListToTextProperty does not seem to work" );
#endif
}
#endif
char* pT = const_cast<char*>(aTitle.getStr());
XTextProperty aProp = { NULL, None, 0, 0 };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment