Bug 67116

Summary: Macros: RemoveByName with IDE Code Window open cause program flow termination
Product: LibreOffice Reporter: irs <irsbugs>
Component: BASICAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: barta, pierre-yves.samyn
Version: 3.3 all versions   
Hardware: Other   
OS: All   
Whiteboard: BSA
i915 platform: i915 features:
Attachments: The attached Writer ODT file contains code that demonstrates the problem.

Description irs 2013-07-20 10:09:04 UTC
Created attachment 82724 [details]
The attached Writer ODT file contains code that demonstrates the problem.

Problem description: 

The method “removeByName()” from the interface “com.sun.star.container.XNameContainer” removes the specified element (module) from the BasicLibraries(“Standard”) correctly. 

However a scenario can exist in which the program exits the subroutine immediately after executing the line of code that contains the “removeByName()” method. When this occurs no error messages are reported.

To create the problem scenario, then the BASIC IDE Code Window must be open, and it must be displaying a module from the document containing the removeByName line of code. 

Once the problem scenario has occurred, then it is necessary to close this document and re-launch it to clear the problem.

Steps to reproduce:
1. Create a BASIC module named "Module2" 
2. In Module1 create a subroutine as follows:

sub Main
	BasicLibraries.getByName("Standard").removeByName("Module2")
	Msgbox "Success: Module2 removed. Bug not observed."
end sub

3. Start execution of the above subroutine from the BASIC IDE Code Window

4. The Msgbox success message does not get executed.

5. The attached Writer ODT file has sample code that can better demonstrate the problem scenario.

Current behavior:
With the BASIC Code Window displaying a module from the program that executes a removeByName() line, then the program flow terminates.

Expected behavior:
With the BASIC Code Window displaying a module from the program that executes a removeByName() line, then the program flow will continue and the subsequent lines of code will be executed.

regards, ian.
              
Operating System: All
Version: 3.3 all versions
Comment 1 irs 2013-07-20 11:38:47 UTC
This problem may be related to: Bug 67118 - BASIC: ReplaceByName - the IDE Code Window does not display the replacement

Note: I was able to observe this problem with LibreOffice V4 versions on Linux 32-bit and 64-bit, Windows XP intel 32 bit, and Mac PowerPC.
 
As I do not have LibreOffice V3.3 I can not prove that the problem actually existed at the time, however I suspect it is likely that it did.

regards, ian.
Comment 2 tommy27 2013-09-10 23:51:49 UTC
@irs 
is bug still here with current 4.1.1 release?
Comment 3 tommy27 2013-11-26 12:30:26 UTC
I move this to NEEDINFO.
please tell us if the issue is still there with recent (4.1.3) LibO releases.
Comment 4 irs 2014-01-06 07:43:32 UTC
(In reply to comment #3)
> I move this to NEEDINFO.
> please tell us if the issue is still there with recent (4.1.3) LibO releases.

Hi Tommy,

The bug still exists using a more recent version of LibreOffice (x86_64 bit):
$ libreoffice --version
LibreOffice 4.1.3.2 410m0(Build:2)

This is on the Linux 64-bit platform: 
$ uname -a
Linux ian-ubuntu-13-10 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I used the Bug Demo scipt 82724 https://bugs.freedesktop.org/attachment.cgi?id=82724 to test for the bug. If the BASIC IDE Window is not opened there is no problem. The bug only occurs once the BASIC IDE window has been opened in a manner as though you are going to edit either Module1 or Module2 of the Bug Demo code.

My guess as to the cause of the bug is that after the "removeByName" has been executed then the BASIC IDE Window is refreshed so that the removed module is no longer displayed. This refresh appears to happen OK as the removed module disappears from the tab list of Modules in the IDE window, however at the end of this sequence it fails to link back and execute the next line of BASIC script code. Instead it quietly exits execution of the script.

regards, Ian.
Comment 5 pierre-yves samyn 2014-01-17 17:08:26 UTC
Hello

I reproduce on windows 7/64 with Version: 4.2.0.2
Build ID: cd65d6220c5694ee7012d7863bcde3455c9e3c30

Regards
Pierre-Yves

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.