On 04/20/2013 09:37 PM, Scott Kostyshak wrote:
On Sat, Apr 20, 2013 at 7:15 PM, Richard Heck <rgh...@lyx.org> wrote:
So what we really needed here is an updateMacros() call, but the other issue
was that this only does what we need it to do---call recordLocation() to set
docit_---if we are exporting the Buffer. So that had to be set, as well.

The attached patch works for me, but there are some things about it that are
a bit hackish at this point. I'll work on it a bit more and fix that
problem.
I tested after your recent commit (db358a43) and with the User's Guide
open I do select all and copy, and I get "The pasted branch Question
is undefined. Do you want to add it to the document's branch list?"
Note that this message appears after a copy, before anything else.

After clicking "Add" or "Don't Add" on the message box and the
following ones, the copy seems to work. Then, if I do select all and
copy again, I immediately get a SIGSEGV.

Can anyone else reproduce this?

Confirmed. I'm not terribly surprised by this. We're asking the temporary Buffer to do more work now than we were before. We saw similar behavior with the advanced F&R stuff at first.

There are a couple issues here. One is the problem of branches. Previously, we'd have "pasted" the copied paragraphs into the temporary Buffer, and with it whatever branch insets were in the copied material, not paying any attention at all to whether those branches existed, etc. I'm not sure what that would mean for what would end up on the clipboard. Probably we can just add a flag to the signature of pasteSelectionHelper() that means: don't ask about this, just do it (or not, which would be the old behavior).

The other issue is the sigsev. Here the problem is that the temporary Buffer we are using in putClipboard is static. So what we do to it remains from call to call. We clear the paragraphs, at the end of that routine, but we don't fully reset the Buffer's InsetText, which is why we get the crash.

So if you remove the static keyword, the crash vanishes, but that does give a bit of a performance hit every time you copy something, because we have to create a new Buffer, with a new tempdir, and so forth. What we might want instead is a way to completely reset this temporary Buffer. Another option would be to keep the static (empty) Buffer and clone it each time, which ought to be cheap.

By the way, I note that this copy is also very slow, because we are converting images to formats suitable for XHTML export, which never get used. We probably need another flag that means: don't do that, or bother creating math images, etc. We might also want to force math to be export as HTML, since the clipboard probably does not know what to do with MathML.

Richard

Reply via email to