Bug 42796 - Macro assigned to dataform Before Unload or While Unloading events are not called when form container is closed
Summary: Macro assigned to dataform Before Unload or While Unloading events are not ca...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-UI
  Show dependency treegraph
 
Reported: 2011-11-10 12:22 UTC by Jurgen
Modified: 2023-09-20 10:19 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Datebase with samples (29.16 KB, application/vnd.sun.xml.base)
2011-11-10 12:22 UTC, Jurgen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jurgen 2011-11-10 12:22:39 UTC
Created attachment 53379 [details]
Datebase with samples

1. create a db and a form 
2. Make a macro for before unloading and while unloading
3. select the macro before unloading in the form

Testing: unload the form and it didn't call the macro

Testing with while unloading and the same thing

It happens also in LibreOffice 3.3 

See the sample
Comment 1 Drew Jensen 2011-11-10 13:24:05 UTC
Ok, I can confirm that a macro assigned to either the Before Unloading or When Unloading events of a dataform are not called when the form document is closed.

I am almost 100% sure this has been a long standing issue, not a recent regression - but I could not find it in any old bug tracking system.

You can verify that the events are called if the dataform is unloaded without the physical form being destroyed by doing the following:

Using Jurgen's example file open the "Customers When Unloading" form for editing.
Turn design mode off.
Turn design mode on - forcing the unload of the data from the dataform. 
The events are called.

Not sure if this will help but - there was a similar issue with the physical form Closed and When Closing events with the old OO.o application along with some detail about the fix for that - you can find that information at: https://issues.apache.org/ooo/show_bug.cgi?id=103371

Also - I edited the summary to better reflect the issue.
Comment 2 Alex Kempshall 2013-03-26 13:31:18 UTC
Confirming this is still an issue in 4.0.0
Comment 3 Alex Kempshall 2013-03-27 09:44:44 UTC
Hi All

I've fallen foul of this bug in recent days so have decided to have a look at it to see if I can provide a patch.

It's been around since November 2011 so possibly no one's looked at it recently.

In the bug report it was confirmed that a macro assigned to either the Before Unloading or When Unloading events of a dataform are not called when the form document is closed.

However, when editing a form and the "Design Mode" option is toggled the events are called. Also the events when the form is loaded are called under all circumstances.

So hopefully here should be enough clues there to provide a solution.

As I haven't provided a patch for a couple of year might take me some time to get back into the swing of things.

If anyone has any suggestions as to where to look fist it would be gratefully appreciated.

Posted this to the bug report and the mailing list

Alex
Comment 4 QA Administrators 2015-02-19 15:47:26 UTC Comment hidden (obsolete)
Comment 5 Stephen Scott 2015-08-24 11:30:38 UTC
I have reproduced the bug exactly as described.
LibreOffice 4.4.5.2
Windows 7 64-bit (up-to-date patches)
Comment 6 QA Administrators 2016-09-20 10:26:02 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2021-09-19 03:44:27 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2023-09-20 03:06:13 UTC Comment hidden (obsolete)
Comment 9 Alex Thurgood 2023-09-20 10:19:33 UTC
Couldn't get this to work for me with

Version: 7.6.1.2 (AARCH64) / LibreOffice Community
Build ID: f5defcebd022c5bc36bbb79be232cb6926d8f674
CPU threads: 8; OS: Mac OS X 13.4; UI render: Skia/Raster; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded

and sample test file from OP, so stil reproducible.