Bug 66707 - lifetime issue of DocumentBasicManager at exit of Base
Summary: lifetime issue of DocumentBasicManager at exit of Base
Status: RESOLVED DUPLICATE of bug 66706
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.1.0.2 rc
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-08 17:34 UTC by Lionel Elie Mamane
Modified: 2013-07-08 17:38 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2013-07-08 17:34:12 UTC
When exiting Base, I got a crash, which seems local to Basic code. Not systematically reproducible. Backtrace attached.

Analysis
#29 0x00007f226a93c553 in basic::ImplRepository::getDocumentBasicManager (this=0x2f44060, _rxDocumentModel=uno::Reference to (dbaccess::ODatabaseDocument *) 0x33e2370)
    at /home/master/src/libreoffice/workdirs/libreoffice-4.1/basic/source/basmgr/basicmanagerrepository.cxx:253
(gdb) list
251	        BasicManagerPointer& pBasicManager = impl_getLocationForModel( _rxDocumentModel );
252	        if ( pBasicManager == NULL )
253	            impl_createManagerForModel( pBasicManager, _rxDocumentModel );

So it seems that here pBasicManager was NULL, and impl_createManagerForModel was called with its first argument being NULL initially.

(gdb) down
#28 0x00007f226a93dfad in basic::ImplRepository::impl_createManagerForModel (this=0x2f44060, _out_rpBasicManager=@0x3b9c848: 0x9999999999999999, _rxDocumentModel=
    uno::Reference to (dbaccess::ODatabaseDocument *) 0x33e2370) at /home/master/src/libreoffice/workdirs/libreoffice-4.1/basic/source/basmgr/basicmanagerrepository.cxx:497
(gdb) list
496	        // register as listener for the BasicManager being destroyed
497	        StartListening( *_out_rpBasicManager );
(gdb) print _out_rpBasicManager
$5 = (basic::BasicManagerPointer &) @0x3b9c848: 0x9999999999999999

The first argument is 0x9999999999999999. From our MALLOC_PERTURB_=153 in ooenv, all 9's is the value that free()d/deleted memory gets. So it seems there is some lifetime issue, but from staring at the code, I don't guess where. impl_createManagerForModel should create a BasicManager and stick it in _out_rpBasicManager, but where would it be destroyed?


Possibly the problem is actually (much) higher? Frame 39/40, I see the destructor of BasicManager; it seems suspicious to me that a new BasicManager is constructed from the destructor of the same type!!
Comment 1 Lionel Elie Mamane 2013-07-08 17:38:27 UTC
Bug was created twice for some reason. Closing second copy as DUP of first.

*** This bug has been marked as a duplicate of bug 66706 ***