To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=113117 Issue #|113117 Summary|extensions: second sanemananger shutdown can crash Component|framework Version|DEV300m84 Platform|All URL| OS/Version|Linux Status|NEW Status whiteboard| Keywords| Resolution| Issue type|PATCH Priority|P3 Subcomponent|code Assigned to|pl Reported by|cmc
------- Additional comments from [email protected] Tue Jul 13 09:33:32 +0000 2010 ------- Under Unix the SANE scanner shutdown (issue 99835) is sort of busted. The dtor of ScannerManager always calls ScannerManager::DestroyData and that always destroys the contents of the allSanes list, but doesn't empty it. allSanes is shared between all ScannerManagers, so after one has shutdown, the rest not reuse a corrupt allSanes. I thought this was really rare, but as it turns out every impress shell creates a ScannerManager and closing every impress shell will call ScannerManager::DestroyData. So start impress insert->picture->scan->select source->cancel, that'll add an entry to allSanes. Start another impress, Close the first impress, now close the second impress. A double free on ScannerManager::DestroyData seeing as the second manager to shutdown frees the same entry that the first one to shutdown did :-( So... a) ScannerManager::DestroyData should use a aSaneProtector guard to control threaded access to the same allSanes as used elsewhere b) When we destroy the entries from allSanes, we should empty it as well c) Even so, its all a bit of a mess is e.g. if the first manager calls ScannerManager::getAvailableScanners and then the second one shutdowns, setting the allSanes length to 0, and then the first manager e.g. uses ScannerManager::configureScanner this will now throw because the values got in ::getAvailableSanes are now false. Putting aside the fact that we have a "list" which can only ever have one entry, how about this solution... Now every ScannerManager acquires and releases in its ctor/dtor a ref count on a shared "allSanes" singleton which drops all resoures when the no of ScannerManagers active hits 0. Late initialiation of the actual SANE stuff remains late on first call to ScannerManager::getAvailableScanners For further prettiness, throw out old DYNARRAY stuff in favour of a vector Change global objects into threadsafe deterministicly-ordered function statics. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
