After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 731980 - Text.GetAttributeRun method overwrites object attributes with the default ones
Text.GetAttributeRun method overwrites object attributes with the default ones
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: at-spi2-atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: At-spi maintainer(s)
At-spi maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-06-20 17:29 UTC by Jacobo Aragunde Pérez
Modified: 2014-06-20 18:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test document (8.50 KB, application/vnd.oasis.opendocument.text )
2014-06-20 17:31 UTC, Jacobo Aragunde Pérez
  Details
Test script (656 bytes, application/octet-stream)
2014-06-20 17:31 UTC, Jacobo Aragunde Pérez
  Details
Patch, git format (1.62 KB, patch)
2014-06-20 17:38 UTC, Jacobo Aragunde Pérez
committed Details | Review

Description Jacobo Aragunde Pérez 2014-06-20 17:29:38 UTC
When calling Text.GetAttributeRun method with the parameter includeDefaults set to True, the attributes of the AtkText object are overwritten by the default attributes. I noticed this behavior when checking the attributes of text got from a LibreOffice text document.

Steps to reproduce the bug:
1. Run the attached listener script
2. Open the attached test document in LibreOffice/OpenOffice
3. Move the caret on the text document and check the output of the script.

Expected output from the script:

  queried getAttributeRun with includeDefaults=True: family-name:Caladea
  queried getAttributeRun with includeDefaults=False: family-name:Caladea

Actual output of the script:

  queried getAttributeRun with includeDefaults=True: family-name:Liberation Serif
  queried getAttributeRun with includeDefaults=False: family-name:Caladea
Comment 1 Jacobo Aragunde Pérez 2014-06-20 17:31:02 UTC
Created attachment 278853 [details]
Test document
Comment 2 Jacobo Aragunde Pérez 2014-06-20 17:31:32 UTC
Created attachment 278854 [details]
Test script
Comment 3 Jacobo Aragunde Pérez 2014-06-20 17:36:55 UTC
Checking the code of impl_GetAttributeRun inside atk-adaptor/adaptors/text-adaptor.c, one can see that the AtkAttributeSet called "attributes" is initialized with the attributes of the AtkText object. If the parameter includeDefaults is set, the list of defaults attributes of the AtkText object is concatenated at the and of "attributes".

My guess is that this list is somehow compacted at a later point, removing the duplicated entries to leave only the last occurrence of each.

A simple patch changing the order of the concatenated lists in impl_GetAttributeRun would fix the issue.
Comment 4 Jacobo Aragunde Pérez 2014-06-20 17:38:00 UTC
Created attachment 278855 [details] [review]
Patch, git format
Comment 5 Mike Gorse 2014-06-20 18:03:14 UTC
Comment on attachment 278855 [details] [review]
Patch, git format

Pushed to master as commit 701607. Thanks for the patch.