Bug 82532 - BASE: Macros: Calling any macro on lost focus in subform grid column causes Base app crash if click to outside form
Summary: BASE: Macros: Calling any macro on lost focus in subform grid column causes ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: Other All
: medium normal
Assignee: Caolán McNamara
QA Contact:
URL:
Whiteboard: target:5.3.0 target:5.2.0.1 target:5.1.5
Keywords: haveBacktrace, preBibisect, regression
Depends on:
Blocks:
 
Reported: 2014-08-12 23:27 UTC by Doug
Modified: 2016-10-25 18:54 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
demonstration document Form1 grid macro crash bug - need to enable macros (15.21 KB, application/vnd.oasis.opendocument.database)
2014-08-12 23:27 UTC, Doug
Details
bt with debug symbols (6.18 KB, text/plain)
2015-01-24 12:07 UTC, Julien Nabet
Details
got something under valgrind (13.13 KB, text/plain)
2016-06-16 15:50 UTC, Caolán McNamara
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug 2014-08-12 23:27:59 UTC
Created attachment 104533 [details]
demonstration document Form1 grid macro crash bug - need to enable macros

This is a form/subform/grid crash problem when any macro is called when a grid subform column loses focus. 

In LO Base

1.  Create form
2.  Create subform
3.  Create grid on subform
4.  Add columns to grid
5.  Add macro/LO Basic call to grid columns on event "when losing focus"
6.  Does not matter what the macro actually is.  In the attached demonstration, the macro is a single comment 'REM' line.


This form (demo attached) will cause applications crashes in the following situations:
1.  Open the form in edit mode
2.  Click the "design mode on/off" button.  Now design mode is off.
3.  Put the cursor on one of the grid columns with the macro called "when losing focus"  In the sample, that is any of the columns in the grid.
4.  Click the "design mode on/off" button.

ACTUAL RESULT:  Application crash.

1.  Change the property of the subform --> Data --> Navigation Bar --> Parent Form  (the sample already has this property set)
2.  Open the form in regular mode.
2.  Put the cursor on one of the grid columns with the macro called "when losing focus"  (in the sample, this is any grid colum)
3.  Click the parent form navigation arrow to go to the next parent record.

ACTUAL RESULT:  Application crash

As noted, the macro is just a comment 'REM' line, so the crash is the result of simply calling the macro in the LO form.  The crash cannot be caused by the LO Basic code, which is just a comment 'REM' line (although I have used other code in the same place, with the same result).
Comment 1 Doug 2014-08-13 01:43:39 UTC
Actually, the application crashes even if security setting prevent macros from running.  Crash occurs in OpenSuse/LO 4.1.6.2 and Windows7/LO 4.3.0.4
Comment 2 robert 2014-08-13 13:26:51 UTC
I could confirm the buggy behavior.
Open the document. You could chose "Enable Macros" or "Disable Macros" (Macro-Security Medium): no difference.
Open the form.
Set the cursor in the tablecontrol (tablecontrol is in the subfrom - no fields of the mainform were shown).
Go to the navigationbar, which shows the rows of the mainform.
Press an arrow to change the row.
LO crashes immediately.

Works in LO 330beta2, first appears in LO 330beta3 - so a regression.

Tested with OpenSUSE 12.3 64bit rpm Linux.

If you remove the connection to the macro in every column of the tablecontrol it works in all other versions. But why should a connection to a macro create a crash, when executing of macros is disabled? Don't know.
Comment 3 Matthew Francis 2014-12-29 07:13:54 UTC
Adding Whiteboard:preBibisect
If this is a regression from all the way back in 3.3, it unfortunately can't be bibisected. Given the quite narrow range given for its first appearance, possibly reading the commit logs may shed some light
Comment 4 Alex Thurgood 2015-01-03 17:38:18 UTC Comment hidden (no-value)
Comment 5 Julien Nabet 2015-01-24 12:07:11 UTC
Created attachment 112774 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated yesterday (5d47b83cef0b2d0486162989722b23e53eb0cdb1), I could reproduce this.
I attached a bt.
Comment 6 Julien Nabet 2015-01-24 12:08:28 UTC
Lionel: thought you might be interested in this one (I updated master sources yesterday, see my previous comment).
Comment 7 Robinson Tryon (qubit) 2015-12-14 05:40:09 UTC Comment hidden (obsolete)
Comment 8 Jean-Baptiste Faure 2016-04-10 08:48:57 UTC
I can't reproduce the crash with LO 5.1.3.0.0+ and the master.
Please test again.

Best regards. JBF
Comment 9 Caolán McNamara 2016-06-16 15:21:56 UTC
This refuses to crash for me in any version, but a good number of confirmation here. Odd
Comment 10 Caolán McNamara 2016-06-16 15:50:30 UTC
Created attachment 125692 [details]
got something under valgrind
Comment 11 Commit Notification 2016-06-16 16:11:02 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=e841ed93d6c6d817be1f7fdc18ff971325c861cc

Resolves: tdf#82532 parent mutex dtored before child dtor uses it

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 12 Commit Notification 2016-06-16 16:16:59 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=1c0d1199fe02666de0d162f071ce7e6e812a23df&h=libreoffice-5-2

Resolves: tdf#82532 parent mutex dtored before child dtor uses it

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 13 Commit Notification 2016-06-17 20:46:47 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=51192fa69388df69a7a5d8f03fec53de61b69050&h=libreoffice-5-1

Resolves: tdf#82532 parent mutex dtored before child dtor uses it

It will be available in 5.1.5.

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.