[Libreoffice-bugs] [Bug 126487] New: id of objects changes on every access

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Jul 20 13:33:58 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=126487

            Bug ID: 126487
           Summary: id of objects changes on every access
           Product: LibreOffice
           Version: 6.2.5.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: hi-angel at yandex.ru

When moving across document hierarchy, sometimes it's needed to determine
whether 2 objects are the same thing *(not in terms of properties/values, but
as in, really refer to the same thing)*. For example, when you have some cell1
and cell2, there's no need to waste energy comparing all properties with cell1
== cell2, when one can just do id(cell1) == id(cell2) (btw, the == operator
doesn't work either).

But for some reason for every access to any UNO object the object id changes.
It doesn't sound right even in terms of performance (like, why to create every
time a different instance?).

# Steps to reproduce

1. Run python shell
2. In python shell execute the following commands

    >>> import uno
    >>> localContext = uno.getComponentContext()
    >>> list_of_same_objects = [localContext.ServiceManager for i in
range(0,10)]
    >>> [id(obj) for obj in list_of_same_objects]
    [139769180615904, 139769180615928, 139769180615952, 139769180615976,
139769180616000, 139769180616024, 139769180616048, 139769180616072,
139769180616096, 139769180616120]

## Expected

The last command should've returned list of the same numbers.

## Actual

All numbers in the last command are different

# Additional information

See also:
https://ask.libreoffice.org/en/question/201705/uno-determine-if-2-objects-refer-to-the-same-thing/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190720/5a93ac3f/attachment-0001.html>


More information about the Libreoffice-bugs mailing list