On 20/10/2010 13:51, Richard Heck wrote:
On 10/20/2010 04:37 AM, Andre Poenitz wrote:
On Wed, Oct 20, 2010 at 03:54:03AM +0200, Peter Kümmel wrote:
I think what's happening is this. If you export pdf (say) without
there
already being a pdf file there, then everything is fine. But if the
pdf
file exists, then LyX will try to ask the user whether to overwrite.
This means creating a dialog as a child of the parent. But the parent,
from what I can tell, is in the main thread, and that's not allowed.
I'll paste the full error I get below. As you'll see, LyX crashes
here.
Here's the backtrace:
This makes it complicated: pass a signal via Qt::QueuedConnection to
the gui thread and wait for the answer before continuing.
Andre, what's the best way to wait for the answer from the gui thread,
QEventLoop?
I personally believe that nested event loops are always evil.
In this case I'd completely stop the export, let the gui pop up
the dialog, and on confirmation re-initiate the export process
with a 'force' flag or such.
I don't know enough about this to know if this is a silly idea or not,
but I'll mention it anyway.
The dialogs we are discussing are all of the frontend::Alert variety.
Indeed, unless I am mistaken, those are the only dialogs we create
from the core. Is there any way we could encapsulate the needed logic
there?
whenever in a thread frontend::Alert could send a signal that would be
caught by GuiView in the main thread. Once sent the thread would sleep
up until it receives a signal from GuiView. Upon reception of the
signal, GuiView would execute the required Alert dialog and send a
signal when done. Should be doable without much work...
Abdel.