Bug 93386 - Crashes when closing a Database with macro editor open
Summary: Crashes when closing a Database with macro editor open
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.3.5.2 release
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.3.0 target:5.2.0.1 target:5.1.4
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2015-08-12 13:35 UTC by PJG51
Modified: 2016-10-25 18:54 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
An example DataBase (38.49 KB, application/vnd.oasis.opendocument.database)
2015-08-13 12:28 UTC, PJG51
Details
Apple crash trace (96.47 KB, text/plain)
2015-08-13 14:22 UTC, Alex Thurgood
Details
bt on master (19.09 KB, text/plain)
2015-08-13 14:44 UTC, Alex Thurgood
Details
bt with debug symbols (12.96 KB, text/plain)
2015-08-15 19:06 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description PJG51 2015-08-12 13:35:07 UTC
Hi,

LibreOffice crashes when I try to close a main DataBase window, if the editing window of macros is open.

Best regards,

PJG
Comment 1 Alex Thurgood 2015-08-13 06:40:30 UTC
@PJG51 : please provide more information

Is the macro editor window open for editing a macro within Base or for another module, or does it make no difference ?

Please indicate version of OSX.
If you have a test file that reproducible causes the problem, please provide it along with instructions on how to reproduce the buggy behaviour.
Comment 2 PJG51 2015-08-13 12:28:04 UTC
Created attachment 117889 [details]
An example DataBase
Comment 3 PJG51 2015-08-13 12:32:04 UTC
Ok, sorry.

This bug occurs only within Base.

Open the joined file, it's a wines cellar base - yes, I'm french… ;-)
A form is open automaticaly, close it.
Edit any macro from this document…
Close the main window (base window) with editing window of macros still open : Bam !

Best regards,

PJF
Comment 4 Alex Thurgood 2015-08-13 14:18:19 UTC
When I open your ODB file, I get an immediate error message :

Erreur d'exécution BASIC.
Sous-procédure ou procédure de fonction non définie.

at the fllowing line :
openConnection(thisDatabaseDocument)
Comment 5 Alex Thurgood 2015-08-13 14:18:54 UTC
I activated macros when loading the file...
Comment 6 Alex Thurgood 2015-08-13 14:21:12 UTC
Thanks, I can confimr the crash with your file.
Comment 7 Alex Thurgood 2015-08-13 14:22:25 UTC
Created attachment 117892 [details]
Apple crash trace
Comment 8 Alex Thurgood 2015-08-13 14:26:01 UTC
No crash in

Version: 4.2.4.2
Build ID: 63150712c6d317d27ce2db16eb94c2f3d7b699f8
Comment 9 Alex Thurgood 2015-08-13 14:30:16 UTC
Hang in LO 4352, killed by OSX task scheduler after x minutes no response

Sounds like a mutex release problem.
Comment 10 Alex Thurgood 2015-08-13 14:39:18 UTC
lldb session, this is what happens when I shut the main base window in master debug :

Process 73808 stopped
* thread #1: tid = 0x34032e, 0x0000000102e5c351 libsvllo.dylib`SfxBroadcaster::AddListener(this=0x0003000128e08140, rListener=0x00000001146a6430) + 81 at SfxBroadcaster.cxx:99, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x0000000102e5c351 libsvllo.dylib`SfxBroadcaster::AddListener(this=0x0003000128e08140, rListener=0x00000001146a6430) + 81 at SfxBroadcaster.cxx:99
   96  	void SfxBroadcaster::AddListener( SfxListener& rListener )
   97  	{
   98  	    DBG_TESTSOLARMUTEX();
-> 99  	    if (mpImpl->m_RemovedPositions.empty())
   100 	    {
   101 	        mpImpl->m_Listeners.push_back(&rListener);
   102 	    }
c
Process 73808 resuming
Process 73808 stopped
* thread #1: tid = 0x34032e, 0x0000000102e5c351 libsvllo.dylib`SfxBroadcaster::AddListener(this=0x0003000128e08140, rListener=0x00000001146a6430) + 81 at SfxBroadcaster.cxx:99, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x0000000102e5c351 libsvllo.dylib`SfxBroadcaster::AddListener(this=0x0003000128e08140, rListener=0x00000001146a6430) + 81 at SfxBroadcaster.cxx:99
   96  	void SfxBroadcaster::AddListener( SfxListener& rListener )
   97  	{
   98  	    DBG_TESTSOLARMUTEX();
-> 99  	    if (mpImpl->m_RemovedPositions.empty())
   100 	    {
   101 	        mpImpl->m_Listeners.push_back(&rListener);
   102 	    }


So the debug code tests for the release of the solarmutex, but then everything gets stuck in a loop. I guess this doesn't happen in the production release code ?
Comment 11 Alex Thurgood 2015-08-13 14:41:10 UTC
@PJG51 : By the way, as an aside, none of the versions of LibreOffice I tested opened the form for me on loading of the ODB. If this worked for you somewhere else, there has been an API change or a code change that means it no longer opens a form directly on the Mac.
Comment 12 Alex Thurgood 2015-08-13 14:44:53 UTC
Created attachment 117893 [details]
bt on master
Comment 13 Alex Thurgood 2015-08-13 14:50:53 UTC
frame variable
(SfxBroadcaster *) this = 0x0003000128e08140
(basic::ImplRepository &) rListener = 0x00000001146a6420: {
  utl::OEventListenerAdapter = (m_pImpl = 0x000000011467e360)
  SfxListener = (mpImpl = 0x00000001146a6470)
  m_aStore = size=0 {}
  m_aCreationListeners = size=2 {
    [0] = 0x0000000114671720
    [1] = 0x0000000114b13330
  }
}
Comment 14 PJG51 2015-08-13 17:49:11 UTC
(In reply to Alex Thurgood from comment #11)
> @PJG51 : By the way, as an aside, none of the versions of LibreOffice I
> tested opened the form for me on loading of the ODB. If this worked for you
> somewhere else, there has been an API change or a code change that means it
> no longer opens a form directly on the Mac.

I use Access2Base, and macro "Start" is run (assigned) at loading of the document.

This macro :

Sub Start

openConnection(thisDatabaseDocument)
openForm("Saisie_Cave")

End Sub
Comment 15 Julien Nabet 2015-08-13 18:16:39 UTC
Jean-Pierre: seeing Access2Base in the last comment of the reporter made me think you might be interested in this one.
Comment 16 Julien Nabet 2015-08-15 19:06:43 UTC
Created attachment 117940 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated yesterday, I could reproduce this.
I attached bt with debug symbols.
Comment 17 Jean-Pierre Ledure 2015-08-16 10:37:42 UTC
Hi,

I could test the ODB file in 2 environments:

- Win 7 + LO 5.0.0.5
- Ubuntu 14.04LTS + LO 4.2.8.2

As a preliminary remark the Sub Start code should be changed  in both environments as follows:

Sub Start
	If GlobalScope.BasicLibraries.hasByName("Access2Base") then
		GlobalScope.BasicLibraries.loadLibrary("Access2Base")
	End If
openConnection(thisDatabaseDocument)
openForm("Saisie_Cave")

End Sub

to have the Access2Base library loaded and avoid the bahaviour described by Alex (comment 4).

Now my observations:
- in Win 7 / LO 5.0 the execution runs smoothly, no buggy behaviour detected.
- in Ubuntu LO crashes indeed in next both cases: on the openForm statement or when opening the "Saisie_Cave" form manually (normal open or open in edit mode do not matter, macros may be deactivated when opened manually). Note that the 2nd form "Saisie_Mouvements" opens gracefully. I also removed the automatic execution of the Start macro, I even removed the PJG Basic module : still opening the "Saisie_Cave" form crashes LO.

My conclusion is that Basic has nothing to do with the crash I observed. Maybe there is something within the internal format of the form that causes trouble in LO 4.2 up to ... ? Maybe the form was created in a recent version and became unreadable in an older one ?

Pleas tell me if I can help further.

Jean-Pierre
Comment 18 Jakobus Schürz 2015-10-03 06:52:02 UTC
I have the same on Linux LO 5.0.2.2

Open a odb-File, editing an Macro, and close the odb-File, while macro-editor is open.

Same behaviour before on LO 4, and also the same on Win7 and Linux on both LO-versions.

gdb: info-stack


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff532f2b1 in SfxBroadcaster::AddListener(SfxListener&) ()
   from /usr/lib/libreoffice/program/libmergedlo.so
(gdb) info stack
#0  0x00007ffff532f2b1 in SfxBroadcaster::AddListener(SfxListener&) ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#1  0x00007ffff5331a4b in SfxListener::StartListening(SfxBroadcaster&, bool) ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#2  0x00007ffff4e45cd0 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#3  0x00007ffff4e4607e in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#4  0x00007fffc3d7cde9 in ?? ()
   from /usr/lib/libreoffice/program/libbasctllo.so
#5  0x00007fffc3d38a9d in ?? ()
   from /usr/lib/libreoffice/program/libbasctllo.so
#6  0x00007fffc3d443e5 in ?? ()
   from /usr/lib/libreoffice/program/libbasctllo.so
#7  0x00007fffc3d3f737 in ?? ()
   from /usr/lib/libreoffice/program/libbasctllo.so
#8  0x00007fffc3d3434c in ?? ()
   from /usr/lib/libreoffice/program/libbasctllo.so
#9  0x00007ffff532edad in SfxBroadcaster::Broadcast(SfxHint const&) ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#10 0x00007ffff4e4ab5e in BasicManager::~BasicManager() ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#11 0x00007ffff4e4ac49 in BasicManager::~BasicManager() ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/libreoffice/program/libmergedlo.so
#12 0x00007ffff4e4424e in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#13 0x00007ffff5f3dda8 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#14 0x00007fffeb9d42f0 in cppu::OInterfaceContainerHelper::disposeAndClear(com::sun::star::lang::EventObject const&) ()
   from /usr/lib/libreoffice/program/libuno_cppuhelpergcc3.so.3
#15 0x00007fffeb9d4ee1 in cppu::OMultiTypeInterfaceContainerHelper::disposeAndClear(com::sun::star::lang::EventObject const&) ()
   from /usr/lib/libreoffice/program/libuno_cppuhelpergcc3.so.3
#16 0x00007fffeb9cb5d3 in cppu::WeakComponentImplHelperBase::dispose() ()
   from /usr/lib/libreoffice/program/libuno_cppuhelpergcc3.so.3
#17 0x00007fffc394f4d4 in ?? ()
   from /usr/lib/libreoffice/program/../program/libdbalo.so
#18 0x00007fffc394fcea in ?? ()
   from /usr/lib/libreoffice/program/../program/libdbalo.so
#19 0x00007fffb4bf2e66 in ?? ()
   from /usr/lib/libreoffice/program/../program/libdbulo.so
#20 0x00007fffeb9cb655 in cppu::WeakComponentImplHelperBase::dispose() ()
   from /usr/lib/libreoffice/program/libuno_cppuhelpergcc3.so.3
#21 0x00007fffb4c7ca81 in dbaui::OGenericUnoController::dispose() ()
   from /usr/lib/libreoffice/program/../program/libdbulo.so
---Type <return> to continue, or q <return> to quit---
#22 0x00007ffff4bb8e61 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#23 0x00007ffff4bb9c45 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#24 0x00007ffff4b03942 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#25 0x00007ffff4affc13 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#26 0x00007ffff4b02814 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#27 0x00007ffff624acfa in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#28 0x00007ffff60686e6 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#29 0x00007ffff62d29c1 in SalGenericDisplay::DispatchInternalEvent() ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#30 0x00007fffe02dbb49 in ?? ()
   from /usr/lib/libreoffice/program/libvclplug_gtklo.so
#31 0x00007fffe02dbbc1 in ?? ()
   from /usr/lib/libreoffice/program/libvclplug_gtklo.so
#32 0x00007fffee38ab6d in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fffee38af48 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#34 0x00007fffee38affc in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007fffe02daf57 in ?? ()
   from /usr/lib/libreoffice/program/libvclplug_gtklo.so
#36 0x00007ffff625f0e3 in Application::Yield() ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#37 0x00007ffff625f165 in Application::Execute() ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#38 0x00007ffff5278fcd in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#39 0x00007ffff62643d1 in ?? ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#40 0x00007ffff6264422 in SVMain() ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#41 0x00007ffff5297e22 in soffice_main ()
   from /usr/lib/libreoffice/program/libmergedlo.so
#42 0x00000000004006fb in ?? ()
#43 0x00007ffff2fffb45 in __libc_start_main (main=0x4006f0, argc=1, 
    argv=0x7fffffffdc38, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdc28) at libc-start.c:287
#44 0x000000000040072f in ?? ()
(gdb)
Comment 19 Julien Nabet 2015-10-03 07:28:36 UTC
"earliest version"
Comment 20 raal 2016-02-19 22:05:19 UTC
This seems to have begun at the below commit.
Adding Cc: to Jan Holesovsky ; Could you possibly take a look at this one?
Thanks

bibisect 4.4max:
here are only 'skip'ped commits left to test.
The first bad commit could be any of: c0323ebfa2d90555a0cef35d7340d65c16b7c44e 182d90b6bc60a33c6692f0295261b68b068ed93a
We cannot bisect more!

git log -1 c0323ebfa2d90555a0cef35d7340d65c16b7c44e
commit c0323ebfa2d90555a0cef35d7340d65c16b7c44e
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sat Mar 14 22:11:52 2015 +0800

    source-hash-f246ac13bd1a12e11eba03cbe3c62ea77293e02e
    
    (Bibisect: This commit covers source commit(s) 6403f2b59b4c83e0899012e5ca0ddd705784350c^1..f246ac13bd1a12e11eba03cbe3c62ea77293e02e which failed to build)
    
    commit f246ac13bd1a12e11eba03cbe3c62ea77293e02e
    Author:     Jan Holesovsky <kendy@collabora.com>
    AuthorDate: Tue Jun 24 13:09:14 2014 +0200
    Commit:     Jan Holesovsky <kendy@collabora.com>
    CommitDate: Wed Jun 25 20:03:19 2014 +0200
    
        pagedesc: It's better when MakePageDesc returns a pointer.
    
        This removes many uses of GetPageDesc(sal_uInt16).
    
        Change-Id: I9660e30d7fccd4336422ba03b19087321a7ae973

git log -1 182d90b6bc60a33c6692f0295261b68b068ed93a
commit 182d90b6bc60a33c6692f0295261b68b068ed93a
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sat Mar 14 22:12:01 2015 +0800

    source-hash-c1be76ec98cb465e07df961843134147100beaa9
    
    commit c1be76ec98cb465e07df961843134147100beaa9
    Author:     Jan Holesovsky <kendy@collabora.com>
    AuthorDate: Tue Jun 24 17:32:28 2014 +0200
    Commit:     Jan Holesovsky <kendy@collabora.com>
    CommitDate: Wed Jun 25 20:03:19 2014 +0200
    
        pagedesc: Consolidate FindPageDescByName() and FindPageDesc().
    
        Change-Id: I18d570509cd3f3b65a19a12a9df0b1d5db901d04

git bisect log
# bad: [cf6ea17155fabb2a120ba07c150735591ac861d7] source-hash-3f94c9e9ddfd807b449f3bb9b232cf2041fa12d2
# good: [fc71ac001f16209654d15ef8c1c4018aa55769f5] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
git bisect start 'latest' 'oldest'
# bad: [8cf60cc706948588e2f33a6d98b7c55d454e362a] source-hash-f340f0454627939f1830826fb5cc53a90e6c62a4
git bisect bad 8cf60cc706948588e2f33a6d98b7c55d454e362a
# bad: [d9885f526fc7a09cc8f9f8ee643af1b966be24bb] source-hash-d1465c64c6f64ad8dd25e40cdc69649b24b305ea
git bisect bad d9885f526fc7a09cc8f9f8ee643af1b966be24bb
# good: [e3eab511ffbcd2e1e2c67e7a4fec162bb0b26b7a] source-hash-dc9cc46f3223aff3f85d3ce9696178a5f4d3d087
git bisect good e3eab511ffbcd2e1e2c67e7a4fec162bb0b26b7a
# good: [1477f347fb61b5b07de64312247b49371812f5b4] source-hash-4598bbe41d0906a34ceb1126c7fce2108642cd8e
git bisect good 1477f347fb61b5b07de64312247b49371812f5b4
# good: [fdbfc593506d9f38152b80f14c9e7afdbef0b40a] source-hash-6024ddbfac8e62db50dd5352d610c87d279627de
git bisect good fdbfc593506d9f38152b80f14c9e7afdbef0b40a
# bad: [b1d1e3e3ac1515cf33be95eba837476142fb6ca8] source-hash-f55ddffd7e81cc8f3314047a6aa62991e2d293b1
git bisect bad b1d1e3e3ac1515cf33be95eba837476142fb6ca8
# bad: [e5308eaa46281027dc932b4a6550e7b1f0ba0622] source-hash-822d0e9db610ce3cbee2cf8d3154ee41218ea562
git bisect bad e5308eaa46281027dc932b4a6550e7b1f0ba0622
# bad: [75c46439114b95c3914ce2b771b1c660443856d0] source-hash-d89d8169716a748c098108eaada789206bb722c3
git bisect bad 75c46439114b95c3914ce2b771b1c660443856d0
# bad: [2313f29360bed2da1747d5c454b8a845e9d254f9] source-hash-bb6d9b0123dcde32fe260f6d1c3e567d1ddfcb35
git bisect bad 2313f29360bed2da1747d5c454b8a845e9d254f9
# good: [55e7160feaf0ab14035ecf800d233bb9a1a81f87] source-hash-1ba95042121983d0bf865e3dd449f8362d119c7c
git bisect good 55e7160feaf0ab14035ecf800d233bb9a1a81f87
# good: [85a301306130f4aae393ff40a0356e8af65f44a0] source-hash-076e4afc61b216e34959bd4e3701f1fa19972d5c
git bisect good 85a301306130f4aae393ff40a0356e8af65f44a0
# bad: [182d90b6bc60a33c6692f0295261b68b068ed93a] source-hash-c1be76ec98cb465e07df961843134147100beaa9
git bisect bad 182d90b6bc60a33c6692f0295261b68b068ed93a
# bad: [182d90b6bc60a33c6692f0295261b68b068ed93a] source-hash-c1be76ec98cb465e07df961843134147100beaa9
git bisect bad 182d90b6bc60a33c6692f0295261b68b068ed93a
# bad: [182d90b6bc60a33c6692f0295261b68b068ed93a] source-hash-c1be76ec98cb465e07df961843134147100beaa9
git bisect bad 182d90b6bc60a33c6692f0295261b68b068ed93a
# bad: [182d90b6bc60a33c6692f0295261b68b068ed93a] source-hash-c1be76ec98cb465e07df961843134147100beaa9
git bisect bad 182d90b6bc60a33c6692f0295261b68b068ed93a
# skip: [c0323ebfa2d90555a0cef35d7340d65c16b7c44e] source-hash-f246ac13bd1a12e11eba03cbe3c62ea77293e02e
git bisect skip c0323ebfa2d90555a0cef35d7340d65c16b7c44e
# only skipped commits left to test
# possible first bad commit: [182d90b6bc60a33c6692f0295261b68b068ed93a] source-hash-c1be76ec98cb465e07df961843134147100beaa9
# possible first bad commit: [c0323ebfa2d90555a0cef35d7340d65c16b7c44e] source-hash-f246ac13bd1a12e11eba03cbe3c62ea77293e02e
Comment 21 Commit Notification 2016-05-31 16:35:18 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a0fd9c7f424fb787e1fae2113f0a42f0895a1e9

Resolves: tdf#93386 crash when closing a Database with macro editor open

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2016-05-31 17:56:20 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9f21b660fe2ed3805614be5d782137554e32e7d2&h=libreoffice-5-2

Resolves: tdf#93386 crash when closing a Database with macro editor open

It will be available in 5.2.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2016-06-01 00:37:49 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4c6f0378a4512c16e43161436b9fe97d802f4516&h=libreoffice-5-1

Resolves: tdf#93386 crash when closing a Database with macro editor open

It will be available in 5.1.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.