Hi Jan,

please try to send ".uno::CloseWin" dispatch request to the frame of the background.odt document to close the document as an experiment.

This request is triggered when you click with the mouse to close the document window. It checks whether there are other frames that prevent termination and terminate the office if necessary. The problem is that your extension seems to close "background.odt" too late, when the UI part has already done its work. In this case the code that closes the last document is responsible to terminate the office. So the easiest way would be to just use the dispatch request to close the remaining "background.odt" as well.

Thus, if I understood the scenario correctly, the dispatch request should let the office be terminated in this scenario.

Hope that helps.

Best regards,
Mikhail.

On 12/03/10 19:15, Jan Rheinländer wrote:
Hello Mikhail,

sorry for the delay. I was away without internet access for a while.

I am not quite sure what do you mean with destructor of the extension.
The extension is defined as a class
class iMath : public cppu::WeakImplHelper6
<
        XDispatchProvider,
        XDispatch,
        XInitialization,
        XServiceInfo,
        XDialogEventHandler,
        XContainerWindowEventHandler
{ ... }
and I am using the constructor to initialize the extension and the
destructor to clean up (e.g. close background.odt)

Are you sure that the code that should close the document is called?
Yes

And if it is called, do you get any exception from the close() call?
no, I put it in a try { ... } catch (Exception &e) { ... } block but
nothing comes up.

Some more detail:
1. I open a document e.g. by calling openoffice.org -writer
myDocument.odt
2. The extension automatically loads background.odt (code see initial
posting)
3. I close myDocument.odt (manually by clicking with the mouse)
4. The destructor of the extension is called automatically, and the
close() executed for background.odt

Back at the command line, ps -eaf lists a running
/usr/lib/openoffice/program/soffice.bin -writer myDocument.odt .
-splash-pipe=5
which needs to be killed manually to terminate.

I tried some other stuff: If I load background.odt in the foreground,
then close it manually by clicking with the mouse, then close
myDocument.odt, the problem disappears.
If I insert the code to close background.odt somewhere else (e.g.
activated by a menu item in the extension), the problem disappears

Maybe the iMath destructor is the wrong place to close background.odt?
If yes, what is the right place? And what about the constructor?

Thanks for any ideas
        Jan






Reply via email to