On Tue, Sep 16, 2003 at 09:49:52PM +0000, Angus Leeming spake thusly:
 
> Martin Vermeer wrote:
> > Hmmmm... is it possible that lang_ is being accessed after the
> > containing class Messages::Pimpl has been destroyed?
> 
> If so, I guess that this is the kludge. Thereafter we'd have to 
> ascertain _why_?
> 
> string const Messages::get(string const & msg) const
> {
>         return pimpl_.get() ? pimpl_->get(msg) : msg;
> }
> 
> -- 
> Angus

Yes that should do the job... but.

I did a little further debugging by instrumenting messages.C as
follows:

    107     string const get(string const & m) const
    108     {
    109         if (m.empty())
    110             return m;
    111 
    112         char * old = strdup(setlocale(LC_ALL, 0));
    113         char * n;
    114         if (lang_.size() < 100)
    115             n = setlocale(LC_ALL, lang_.c_str());
    116         else {
    117             n = setlocale(LC_ALL, string("en_US").c_str());
    118             lyxerr << "error:" << lang_.size() << " " << m << std::endl;
    119         }
    120         const char* msg = gettext(m.c_str());
    121         setlocale(LC_ALL, old);
    122         free(old);
    123         // If we are unable to honour the request we just
    124         // return what we got in.
    125         return (!n ? m : string(msg));
    126     }

Creating a Note inset, a Minipage inside it, and copying pasting the
latter, I get:

error:1932487777 Close
error:1932487777 Cancel
error:1932487777 Minipage Settings

(the number value doesn't change on recompile)

It turns out that the trouble is caused by three localized strings:

1) in frontends/xforms/dialogs.C the build() routine:

   153     dialog->bc().view(new xformsBC(dialog->bc()));

The call to xformsBC has two default string parameters, see
frontends/xforms/xformsBC.h:

     22 class xformsBC : public GuiBC<FL_OBJECT, FL_OBJECT> {
     23 public:
     24     ///
     25     xformsBC(ButtonController const &,
     26          string const & = _("Cancel"), string const & = _("Close"));

...and then there are the Form*.C files, e.g. FormMinipage.C:

     34 FormMinipage::FormMinipage(Dialog & parent)
     35     : base_class(parent, _("Minipage Settings"))
     36 {}

This is where the three strings come from.

Does this ring any bells?

But remember also that *pasting* the dialog'ed inset is mandatory to
get the invalid lang_. Create the same inset geometry the regular way
will *not* produce it.


BTW the above kludge does *not* work. No difference. So the
Messages::Pimpl instantiation is existing, but lang_ is messed up.

- Martin

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to