Created attachment 188915 [details] presentation containing macros Open attached 'PresentationInclMacro.odp' document and allow macro execution. Open the Basic IDE. (Tools > Macros > Edit Macros) Go to the library 'MiniExampleMCGR' in 'PresentationInclMacro.odp' and then to module 'Main'. Make sure the cursor is in the edit window, e.g at sub AssignExampleGradientToSelectedShape. Now you have an open Basic IDE and an open presentation document. Go back to the document. Close it. => Crash. Expected: The Basic IDE puts the cursor into an existing library, e.g. 'Standard' from 'My Macros & Dialogs', which always exists, and then silently removes the document from the 'Object Catalog'.
Created attachment 189034 [details] Callstack
Possibly a duplicate of Bug 140339. Will confirm with QA team.
Bibisected with win64-7.6 to f3e127217d8daa443b8eda52ac4810e375cc7d63 use comphelper::WeakComponentImplHelper in DocumentEventNotifier::Impl Commit touches basctl/source/basicide/doceventnotifier.cxx Double-checked the previous commit doesn't crash.
Just for the record, on pc Debian x86-64 with master sources updated today, I got no crash but an hang.
(In reply to Julien Nabet from comment #4) > Just for the record, on pc Debian x86-64 with master sources updated today, > I got no crash but an hang. Yeah, that was my experience on Linux master as well (dbgutil). That's why I thought it better to bisect on Win.
Ctrl-C the hang, I noticed this: #7 0x00007f672079f541 in std::unique_lock<std::mutex>::unique_lock(std::mutex&) (this=0x7ffd61b12bf8, __m=...) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_lock.h:71 #8 0x00007f67208646a2 in basctl::DocumentEventNotifier::Impl::documentEventOccured(com::sun::star::document::DocumentEvent const&) (this=0x557f4d20a8e0, _rEvent=...) at basctl/source/basicide/doceventnotifier.cxx:119 #9 0x00007f676dca1041 in (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(com::sun::star::document::DocumentEvent const&)::$_1::operator()(com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener> const&) const (this=0x7ffd61b12d08, xListener=uno::Reference to (basctl::DocumentEventNotifier::Impl *) 0x557f4d20a918) at sfx2/source/notify/globalevents.cxx:493 #10 0x00007f676dca0e81 in comphelper::OInterfaceContainerHelper4<com::sun::star::document::XDocumentEventListener>::forEach<(anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(com::sun::star::document::DocumentEvent const&)::$_1>(std::unique_lock<std::mutex>&, (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(com::sun::star::document::DocumentEvent const&)::$_1 const&) const (this=0x557f4d150df8, rGuard=..., func=...) at include/comphelper/interfacecontainer4.hxx:304 #11 0x00007f676dca0aa0 in (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(com::sun::star::document::DocumentEvent const&) (this=0x557f4d150d50, aEvent=...) at sfx2/source/notify/globalevents.cxx:490 #12 0x00007f676dc9e0f2 in (anonymous namespace)::SfxGlobalEvents_Impl::documentEventOccured(com::sun::star::document::DocumentEvent const&) (this=0x557f4d150d50, Event=...) at sfx2/source/notify/globalevents.cxx:226 #13 0x00007f676dc38dac in (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator()(com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener> const&) const (this=0x7ffd61b13000, listener=uno::Reference to ((anonymous namespace)::SfxGlobalEvents_Impl *) 0x557f4d150d98) at sfx2/source/doc/sfxbasemodel.cxx:3280 #14 0x00007f676dc28999 in comphelper::OInterfaceContainerHelper2::forEach<com::sun::star::document::XDocumentEventListener, (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> >((anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> const&) (this=0x557f508c4140, func=...) at include/comphelper/interfacecontainer2.hxx:271 #15 0x00007f676dc28056 in SfxBaseModel::postEvent_Impl(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, com::sun::star::uno::Any const&) (this=0x557f5123bfe0, aName="OnTitleChanged", xController=empty uno::Reference, supplement=uno::Any(void)) at sfx2/source/doc/sfxbasemodel.cxx:3314 #16 0x00007f676dc275d8 in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) (this=0x557f5123bfe0, rBC=..., rHint=...) at sfx2/source/doc/sfxbasemodel.cxx:2951 #17 0x00007f676cd587a4 in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x557f53cdd210, rHint=...) at svl/source/notify/SfxBroadcaster.cxx:40 #18 0x00007f676db771e7 in SfxObjectShell::SetTitle(rtl::OUString const&) (this=0x557f53cdd210, rTitle="My Macros & Dialogs.Standard") at sfx2/source/doc/objmisc.cxx:704 #19 0x00007f6720805821 in basctl::Shell::SetMDITitle() (this=0x557f5123bbd0) at basctl/source/basicide/basides2.cxx:121 #20 0x00007f672080a37a in basctl::Shell::SetCurLib(basctl::ScriptDocument const&, rtl::OUString const&, bool, bool) (this=0x557f5123bbd0, rDocument=..., aLibName="Standard", bUpdateWindows=true, bCheck=false) at basctl/source/basicide/basidesh.cxx:961 #21 0x00007f672080cad5 in basctl::Shell::onDocumentClosed(basctl::ScriptDocument const&) (this=0x557f5123bbd0, _rDocument=...) at basctl/source/basicide/basidesh.cxx:347 #22 0x00007f6720864a64 in basctl::DocumentEventNotifier::Impl::documentEventOccured(com::sun::star::document::DocumentEvent const&) (this=0x557f4d20a8e0, _rEvent=...) at basctl/source/basicide/doceventnotifier.cxx:166 So it seems we need a kind of recursive lock/mutex/guard (sorry I don't get the difference between all of these).
Noel Grandin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/ab38a8d13de0b14b3c389ef27152aac958033401 tdf#156721 Crash if cursor in Basic IDE is in a macro from a document.. It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Noel: I confirm I don't reproduce the crash anymore after your fix, thank you! :-)
Noel Grandin committed a patch related to this issue. It has been pushed to "libreoffice-7-6": https://git.libreoffice.org/core/commit/883947f5c26f7b672954d0c051b171e70a74734b tdf#156721 Crash if cursor in Basic IDE is in a macro from a document.. It will be available in 7.6.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.