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)
(earliest affected)
3.4.3 release
Hardware: All Windows (All)
: medium major
Assignee: Not Assigned
Depends on:
Blocks: Macro-UI
  Show dependency treegraph
Reported: 2011-11-10 12:22 UTC by Jurgen
Modified: 2019-09-19 12:06 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:

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

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

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.
Windows 7 64-bit (up-to-date patches)
Comment 6 QA Administrators 2016-09-20 10:26:02 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present on a currently supported version of LibreOffice 
(5.1.5 or 5.2.1  https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the version of LibreOffice and 
your operating system, and any changes you see in the bug behavior
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave 
a short comment that includes your version of LibreOffice and Operating System

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)

If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3)


2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to "inherited from OOo";
4b. If the bug was not present in 3.3 - add "regression" to keyword

Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team