Download it now!
Bug 67116 - Macros: RemoveByName with IDE Code Window open cause program flow termination
Summary: Macros: RemoveByName with IDE Code Window open cause program flow termination
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Macro-UI
  Show dependency treegraph
 
Reported: 2013-07-20 10:09 UTC by irs
Modified: 2019-09-19 13:12 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The attached Writer ODT file contains code that demonstrates the problem. (33.87 KB, application/vnd.oasis.opendocument.text)
2013-07-20 10:09 UTC, irs
Details

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 6 Joel Madero 2015-05-02 15:41:26 UTC Comment hidden (obsolete)
Comment 7 pierre-yves samyn 2015-05-09 11:04:27 UTC
Hi

Still reproduced on windows 7/64 & Version: 4.4.3.2
Build ID: 88805f81e9fe61362df02b9941de8e38a9b5fd16
Locale: fr_FR

Regards
Pierre-Yves
Comment 8 QA Administrators 2016-09-20 09:41:49 UTC Comment hidden (obsolete)
Comment 9 Buovjaga 2019-08-11 11:00:24 UTC
Still repro. I don't see the messagebox with "This message is displayed as after the removeByName() was performed, the subroutine did not terminate", if I have IDE open.

Arch Linux 64-bit
Version: 6.4.0.0.alpha0+
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019