I'm using the documents attached to bug 93565 for my test. Actually I found the crash when debugging and fixing it. Steps to reproduce: 1. Open the odt 2. Register the ods as the database using the MM wizard step 3 using the "Select different address list" button. Then cancel the wizard. This way the DB is registered as an EmbeddedDatabase. 3. Run a mail merge via File => Print ... 4. Observe the crash The crash doesn't happen the 2nd time with an already registered DB. The crashing state can be easily restored by opening the "data sources" (F4) -> Right click -> "registered databases..." -> delete the database "1247_TabAttestati", or removing the user profile. For me the crash happens in line ~/Development/libreoffice/symbols/sw/source/uibase/dbui/dbmgr.cxx:1040 nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; bibisecting resulted in: git log 9f01951b858453684f2622541af0eb85d4544fc6~1..8ae25bbc092254f680e2976873f15bdbc26615ef git log --pretty=oneline 9f01951b858453684f2622541af0eb85d4544fc6~1..8ae25bbc092254f680e2976873f15bdbc26615ef sw d611b2e0b2b713ffaf8b2ec75e6a74180316f50b sw: add SwDBManager::RevokeDataSource() b79017f49a487a3981b1cd9f488ed5062eeb880b sw: move name of the embedded data source def from SwDBData to SwDBManager 9eb16c85d6af4b73de9a75716c3ff34f929f26b2 don't crash on layout of ooo55381-1.sxw 77df4faa4783df38383020a6236136a88eb51069 fix crash on export of ooo39845-7.sxw to .docx cf7439c5510578572b30a92a52549b5babfa93d9 SwDBManager: store of embedded data source definition is implemented c61065b262051e510ab5229a8f10efc10962137f SwAddressListDialog::LoadHdl_Impl: simplify 9d0c6308be5fb086e51cb8b4b0652f3d6184fd3c fix crash on export of ooo34469-1.sxw to docx 8d2fe8d7e5f374f3a106a4fc58ef597a52815ad0 SwView::SearchAndWrap: fix WrapAround search in fly frames 21a6b99748db8a970ef7dc90d40e07901135b89a tdf#91781 Fix some entry headings 9f01951b858453684f2622541af0eb85d4544fc6 tdf#91228 Fix Writer crash so it's probably "embedded database" related
BTW: the crash is actually an uncaught exception somewhere down in pImpl->pMergeData->xResultSet->getRow()
Created attachment 121742 [details] Backtrace when closing libreoffice-5-0 build Might be related or not. LO 5.0 doesn't crash but shows the attached BT on close after the MM.
I don't understand, why it crashes, but here is the test case: 1. Have a document with MM fields but no embedded DB 1.1 Deregister the DB of the fields, if it is already registered (F4, Right Click, Registered DBs... , Delete DB) 2. Register the DB via MM Wizard (Go to step three and select the datasource) => The DB is registered as an embedded DB. 3. Cancel the Wizard 4 Use File -> Print... -> MM 5. Run any MM with the DB from this document 6. Crash, as an Exception from The actual crash is the DisposedException() from ::connectivity::checkDisposed(m_rBHelper.bDisposed); in void ORowSetBase::checkCache() "Fun" facts: * If you open a second document with MM fields from the same DB, no crash * If you reopen the MM wizard and use the DB, no crash * If you save and load the document, no crash
Ok - now finally I have found the origin of the problem and it's much worse :-( You can't merge any document with embedded databases via File -> Print. Workflow of SwDBManager::ExecuteFormLetter is: 1. Open dialog 2. Get XResultSet 3. Save document 4. Load saved document => disposes XResultSet, as we have a 2nd embedded DB with the same name. 5. Bad things happen. This is a more general problem. And SwDBManager::ExecuteFormLetter should use an internal clone instead of a load save cycle.
Just going to set this to NEW as its you jmux. :D
https://cgit.freedesktop.org/libreoffice/core/commit/?id=aeb01b75e56916bf36707ad703a16c90ad7f2419
TESTING with LO 5.2.0.0.alpha1+ OS Version: Mac OS X 10.10.5 Build: 2016-05-11_01:01:27 (In reply to Jan-Marek Glogowski from comment #3) > I don't understand, why it crashes, but here is the test case: > Repro Steps: > 1. Have a document with MM fields but no embedded DB - Nab the test docs from bug 95293 (attachment 121094 [details]) - Open 'serial_letter_TDF_95293.fodt' > 1.1 Deregister the DB of the fields, if it is already registered > (F4, Right Click, Registered DBs... , Delete DB) Hmm...not sure that works on OSX. I tried: - LibreOfficeDev -> Preferences -> LibreOfficeDev Base -> Databases I then selected the db entry and clicked (Delete) > 2. Register the DB via MM Wizard > (Go to step three and select the datasource) - Tools -> MM Wizard -> (etc...) - I selected 'Tabelle1' - I stopped immediately after *registering* the Address List > => The DB is registered as an embedded DB. > 3. Cancel the Wizard > 4 Use File -> Print... -> MM > 5. Run any MM with the DB from this document Choosing File -> Print, I'm prompted to print a form letter; Clicking (OK), I can then chose 'Print'; for printer I clicked on the 'PDF' drop-down and Saved As PDF (name: 'Output_96914') > 6. Crash, as an Exception from > > The actual crash is the DisposedException() from > ::connectivity::checkDisposed(m_rBHelper.bDisposed); > in void ORowSetBase::checkCache() NO REPRO. PDF was saved as expected. I then tried clicking directly on the 'Print Merged Documents' button in the mail merge toolbar, and again no crash occurred. Jan-Marek: What's the current status here?
This bug should have been fixed with the commit in comment #6: > https://cgit.freedesktop.org/libreoffice/core/commit/ > ?id=aeb01b75e56916bf36707ad703a16c90ad7f2419 And as Robinson proved, it really seems to be fixed :-)
*** Bug 100299 has been marked as a duplicate of this bug. ***