Dear all,
I wrote an extension that was meant to provide a more liberal replacement to 
the list of recently opened documents. All features are exposed in a modal 
dialog that gets opened through a menu item. The dialog contains action buttons 
for managing the items in the (unbounded as of now) list. One of the buttons is 
a "Open" button, which, because of the Grid API, can only operate on one single 
file.
The problematic scenario to which I'm trying to find a solution is this one:   
   - user launches OpenOffice; there is one window frame (with Minimize, 
Maximize/restore, and Close buttons)   

   - user uses a menu item to open the dialog of the extension; there are then 
one dialog window and one frame
   - user selects a document in the Grid list of the extension and clicks the 
Open button; the extension uses an XComponentLoader to load the file
   - after the file has loaded, there are two frames (one forefront frame with 
the opened file and one background frame with the dialog still opened)
   - user works on the file and presses the Close button in the upper right 
hand corner of the forefront frame
   - all windows (the two frames and the dialog) disappear from the screen
   - user thinks the process is terminated but Process Explorer shows that 
soffice.bin has actually entered a mode where it keeps a CPU core at 100% 
usage, indefinitely.   

By various tests, I determined that the reason behind the never-ending closing 
is that the dialog window wasn't closed.
Therefore, the solution is to have the dialog close automatically when the user 
exits the application. Since I was already intercepting the OnCloseApp to save 
data, I thought I could just as well close the dialog there but that created 
another problem that manifests itself in two ways:   
   - when in NetBeans debug mode, I see in the output that an 
EXCEPTION_ACCESS_VIOLATION error occurred in vcl.dll.
   - when the extension is installed in an instance of OO, everything seems to 
happen normally but on the next launch, the document recovery window opens.
My guess is that closing the dialog while handling OnCloseApp fails because the 
parent window (or some resources) have already been freed when the OnCloseApp 
event is notified. The sequence of events that I get is: OnPrepareViewClosing, 
OnPrepareUnload, OnViewClosed, OnUnload, OnUnfocus, OnCloseApp. I can't close 
the dialog when I get an OnPrepareViewClosing event because there might be 
times when this event doesn't mean an OnCloseApp will happen later on in the 
sequence.

Questions:   
   - does anyone see a way to properly (and automatically) close the dialog of 
my extension at application exit time? I'm looking for the appropriate place 
where to hook in and close the dialog.   

   - is it possible to avert an app exit sequence which was triggered by the 
user?   


Thank you.

Reply via email to