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@lists.freedesktop.org
Reporter: hi-an...@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.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs