Opened 15 years ago

Last modified 14 years ago

#5876 closed defect

AutoCompletingComboBox gets initialized with wrong value for "key:subkey" key elements in custom presets.xml — at Version 8

Reported by: ax Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: Cc:

Description (last modified by ax)

EDIT: please see comment #7 for how to reliably reproduce this bug. the original description below might be misleading.


how to reproduce:

in a data layer that has has both "key" and "key:subkey" elements, eg. elements tagged with "source=bing" as well as elements tagged with "source:population=psgc", if you try editing "source=bing" in the properties panel by double-clicking or pressing "edit", the key will be initialized with the wrong value "source:population=psgc". even if you only change the value and don't touch the key, the key will be changed nevertheless because it is wrongly initialized!

cause:

AutoCompletingComboBox::insertString(..., "source", ...) calls AutoCompletingComboBox::lookupItem("source"). This method loops through all existing keys in the current layer and returns a key that '''starts with''' "source". as "source" is before "source:population" in the list being iterated over, bestItem is first set to the correct value "source", but in the next iteration overwritten with the wrong value "source:population". this wrong key is then inserted into the combobox.

solution:

i'm not familiar with the autocomplete code. on a first glance, i don't understand why AutoCompletingComboBox::insertString() needs a fuzzy startsWith to insert a discret item. but there might be a reason behind this. which is why i leave the fix to this issue to someone who knows :)

Change History (11)

in reply to:  description ; comment:1 by bastiK, 15 years ago

Replying to ax:

how to reproduce:

in a data layer that has has both "key" and "key:subkey" elements, eg. elements tagged with "source=bing" as well as elements tagged with "source:population=psgc", if you try editing "source=bing" in the properties panel by double-clicking or pressing "edit", the key will be initialized with the wrong value "source:population=psgc". even if you only change the value and don't touch the key, the key will be changed nevertheless because it is wrongly initialized!

Tried this, but could not reproduce. Can you provide a *.osm file, e.g. with only 2 nodes in it?

in reply to:  1 comment:2 by ax, 15 years ago

Replying to bastiK:

Tried this, but could not reproduce. Can you provide a *.osm file, e.g. with only 2 nodes in it?

sure - here you go. one node containing both "key" and "key:subkey" actually is enough. try editing the "source" of attached node.

by ax, 15 years ago

Attachment: 5876.osm added

comment:3 by ax, 15 years ago

or might this be because of a custom preset file containing "source:population"? i'll attach that as well.

by ax, 15 years ago

Attachment: presets_ax.xml added

comment:4 by ax, 15 years ago

oh well - seems to be the preset file indeed. if i enable that and load 5876.osm, i get the bug as described. anything wrong with the presets_ax.xml?

comment:5 by ax, 14 years ago

Priority: majornormal
Summary: AutoCompletingComboBox gets initialized with wrong value if data layer has both "key" and "key:subkey" elementsAutoCompletingComboBox gets initialized with wrong value if data layer has both "key" and "key:subkey" elements and there is a "key:subkey" in presets.xml

comment:6 by ax, 14 years ago

Priority: normalmajor
Summary: AutoCompletingComboBox gets initialized with wrong value if data layer has both "key" and "key:subkey" elements and there is a "key:subkey" in presets.xmlAutoCompletingComboBox gets initialized with wrong value for "key:subkey" key elements in custom presets.xml

comment:7 by ax, 14 years ago

finally able to reliably reproduce this:

  • add attached presets_bug_5876.xml to your presets (Edit > Preferences > Map Settings > Tagging Presets > Active Presets > Add; OK; Restart)
  • open a new empty layer
  • add an empty node
  • apply the preset "Bug 5876" to this point (accept default)
  • to the same node, add "source=bla" via properties panel
  • select the "source=bla" line in the properties panel and double-click or "Edit"

result: in the panel that pops up, the selected value in the "Key" combobox is "source:population", not "source" as expected.

bastiK, please help! :)

by ax, 14 years ago

Attachment: presets_bug_5876.xml added

comment:8 by ax, 14 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.