Hello Andreas,

I want to change the code:
String SvtUserOptions_Impl::GetFirstName() const
{
        ::rtl::OUString sFirstName;
        try
        {
                m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
        }
        catch ( const css::uno::Exception& ex)
        {
                LogHelper::logIt(ex);
        }
        return String(sFirstName);
}

TO:
const String& SvtUserOptions_Impl::GetFirstName() /*const*/
{
        ::rtl::OUString sFirstName;
        try
        {
                m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
        }
        catch ( const css::uno::Exception& ex )
        {
                LogHelper::logIt(ex);
        }
m_aUserString = String( sFirstName); //m_aUserString is defined in the SvtUserOptions_Impl
        return  m_aUserString;
}

So the other similar code will be like:
const String& SvtUserOptions_Impl::GetLastName() /*const*/
{
        ::rtl::OUString sLastName;
        try
        {
                m_xData->getPropertyValue(s_ssn) >>= sLastName;
        }
        catch ( const css::uno::Exception& ex)
        {
                LogHelper::logIt(ex);
        }
        m_aUserString = String( sLastName );
        return  m_aUserString;
}
...

If changes like above, there will be no necessary to change the define of Class SvtUserOptions.
How do you think of above changes comparing the incompatible changes?

When redesigning svtools\source\config\useroptions.cxx,
I made like below changes:

String SvtUserOptions_Impl::GetFirstName() const
{
    ::rtl::OUString sFirstName;
    try
    {
        m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
    }
    catch ( const css::uno::Exception& ex)
    {
        LogHelper::logIt(ex);
    }
    return String(sFirstName);
}

The OOo still will crash when opening Menu:Tools->Options. The crash point is aFirstName.SetText( aUserOpt.GetFirstName() ) in SvxGeneralTabPage::SetAddress_Impl();

BTW, "const String& SvtUserOptions::GetFirstName() const" isnt made any changes. Does this method need changes too?

Yes - of course this method needs to be redesigned too.
Otherwise it returns a pointer to a temp. variable (temp generated by the compiler) ... and some [ms] later it will crash :-) because such temp object was already destroyed.

Needing your help to solve this problem.:-)


Regards
Yan Wu

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to