Bug 92420 - Use of a specific field after dispose: not working anymore (it used to work)
Summary: Use of a specific field after dispose: not working anymore (it used to work)
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.4.0.0.alpha0+ Master
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks:
 
Reported: 2015-06-29 09:51 UTC by Carles Pina
Modified: 2015-12-17 09:15 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Basic example that works on LO 4.3 but not on 4.4 (927 bytes, text/plain)
2015-06-29 09:51 UTC, Carles Pina
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carles Pina 2015-06-29 09:51:35 UTC
Created attachment 116909 [details]
Basic example that works on LO 4.3 but not on 4.4

The behaviour of LibreOffice Basic changed in LO 4.4. The new behaviour might make sense (I'm not a Basic expert) but some macros might rely on the previous behavior.

Basically it can be summarized (see the attachment for a working example):

    Set oRange = oMark.Anchor

    ' If oMark.dispose is not called: it works on LO 4.4
    oMark.dispose

    ' Use oRange
    oRange.text.insertTextContent(oRange, oField, true)

In LO 4.3 oRange is valid (even if oMark got disposed) (does it use a reference counter and avoids destroying oMark?).

In LO 4.4 oRange is not valid and the last line causes an exception:
BASIC runtime error.
An exception occurred 
Type: com.sun.star.lang.IllegalArgumentException
Message: first parameter invalid.

I'm not sure if this should have worked on LO 4.3 (and all the previous ones) or was working due to a bug there.

We found it because a code like this exists in the Mendeley Desktop plugin:
https://github.com/Mendeley/openoffice-plugin/issues/16

Obviously I've simplified the code.

If this should not work I'll change MD code to avoid using the range of the diposed mark (I might try to change our code anyway).
Comment 1 Cor Nouws 2015-07-07 08:47:48 UTC
Hi Carles,

thanks for reporting and the clear example.
Testing on Ubuntu 32 bits here.
In 4.4.4.3 and 4.3.7.2

I see the same behaviour and result in both versions.
First there is a field, then it is replaced by a bookmark.
Is this what is expected (I would say yes .. ;) ) ?

It makes no difference for me to remark oMark.dispose..
Comment 2 Carles Pina 2015-07-07 08:57:16 UTC
When I tested I used "Version: 4.4.3.2" and previous versions of 4.4 (I just re-tested again). I'll test now using 4.4.4.3 and report again.
Comment 3 Carles Pina 2015-07-07 09:04:28 UTC
I've confirmed that the problem doesn't happen on 4.4.4.3 (it happens on 4.4.3.2) - so I guess that this cuold be closed. Thanks for having a look!
Comment 4 Cor Nouws 2015-07-07 11:43:02 UTC
Thanks for your additional test and reporting back.
I close as WorksForMe, since we have no idea what possibly fixed it.

Ciao, Cor
Comment 5 Robinson Tryon (qubit) 2015-12-17 09:15:22 UTC
Migrating Whiteboard tags to Keywords: (bibisectRequest)
[NinjaEdit]