http://openoffice.org/bugzilla/show_bug.cgi?id=117585

        Issue Type: DEFECT
           Summary: closing a document programmatically results in event
                    order different from when closing it by UI
    Classification: Code
           Product: framework
           Version: DEV300m104
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: code
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
                CC: [email protected]


Recently, the implementation of the TDOC UCP has been modified to remove a
document which it keeps track of when the XCloseListener::notifyClosing event
arrives. Before that change, the removal was done when the OnUnload event was
notified via the XDocumentEventBroadcaster.
See http://hg.services.openoffice.org/DEV300/rev/8284f36e91bb#l15.130

The change was necessary since there are other listeners which react on the
OnUnload event, and rely on the document still being tracked on the TDOC UCP -
which is not guarateed if the TDOC UCP removes the document upon OnUnload.

So, the assumption here was that the notifyClosing event always arrives after
the OnUnload event, so the removal can happen in notifyClosing.

This assumed order of events is true when you close the document via user
interface.

However, it is *not* true when you close the document programmatically - in
this case, notifyClosing fires *before* OnUnload.

fs->mab: Talked about this with MBA, and we agreed that all means to close a
document should fire the events in the same order - which in this case would
probably mean some refactoring of the SFX code. I don't remember the exact
details of the Great Plan MBA and /me created for this, but I offer my help to
re-create it :)

To illustrate the problem, use the complex.sfx2.DocumentEvents test case, to be
found in the sfx2/qa folder. Uncomment the "@Test" in front of the
testCloseByAPI method, and run the test - it will fail now in exactly this
method, complaining about a wrong event order.

Note(1): The test is committed to CWS fs34b at the time of this writing, and
still needs to manifest in MWS.

Note(2): There's actually two test methods which are currently not ran:
testCloseByAPI, and testCloseDocEvents. The former does an XCloseable::close on
the document, the latter dispatches an ".uno:CloseDoc" URL to the document's
view. Interestingly, the latter fails, too, while dispatching a ".uno:CloseWin"
(see testCloseWinEvents) succeeds, i.e. fires the proper events.

Note(3): when this bug here is fixed, pleas re-enable the assertion at
http://hg.services.openoffice.org/DEV300/file/076c4e717cd4/ucb/source/ucp/tdoc/tdoc_docmgr.cxx#l430.
At the moment, this assertion is disabled, since it is triggered during the
smoketest (which closes documents programmatically), and thus (since CWS
debuglevels) breaks the smoketest.

-- 
Configure bugmail: http://openoffice.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification
from Bugzilla. Please log into the website and enter your comments.
---------------------------------------------------------------------
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help
--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help

Reply via email to