Opened 8 years ago

Closed 7 years ago

#14146 closed defect (fixed)

wxComboBox::SetString trashes associated data

Reported by: aasselin Owned by:
Priority: normal Milestone: 2.9.4
Component: wxOSX Version: stable-latest
Keywords: client data loss, wxComboBox Cc:
Blocked By: Blocking:
Patch: yes

Description

when calling mycombo->SetString(0, "hello") associated client data is lost, as well as type of client data if there is a single item in the combo

the implementation is using Delete(n); Insert(s,n); maybe it should be GetComboPeer()->RemoveItem(n); GetComboPeer()->InsertItem(n,s) ?

Attachments (1)

combobox_osx.setstring.cpp.patch download (455 bytes) - added by aasselin 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by aasselin

comment:1 Changed 7 years ago by vadz

  • Milestone set to 2.9.4

This looks correct to me. I've also looked at NSComboBox to see if there was a way to replace the item directly, without removing and inserting it, but there doesn't seem to be any way to do it, so this patch is the best we can do.

Of course, as mentioned in #12419, we really ought to be using a data source with the combobox instead of mucking with its items anyhow, to be able to implement sorting in it. But this will have to wait :-(

comment:2 Changed 7 years ago by vadz

  • Patch set

comment:3 Changed 7 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [71942]) Preserve client data in wxComboBox::SetString() in wxOSX/Cocoa.

Don't reset the client data to NULL when we're just changing the item text.

Closes #14146.

Note: See TracTickets for help on using tickets.