Re: Removing text from ComboBoxText



I have checked that and get_active_text is using

inline Glib::ustring
convert_return_gchar_ptr_to_ustring(char* str)
{
  return (str) ? Glib::ustring(Glib::make_unique_ptr_gfree(str).get()) : Glib::ustring();
}

So there is no problem with that

And remove_text is

void ComboBoxText::remove_text(int position)
{
  gtk_combo_box_text_remove(gobj(), position);
}

So, I do not understand what is going on.

On 29/05/2019 11:15, Daniel Boles via gtkmm-list wrote:

Yes, it simply not valid to construct an std::string, and hence nor a Glib::ustring, from a nullptr. So if any code in gtkmm is not converting a C nullptr string to a C++ "", that's a bug.

> Returns the currently active string in combo_box, or nullptr if none is selected.

Saying nullptr in documentation like this is simply wrong, because it gets auto-translated from C but we don't change that to "" as we should (and I opened a bug for). That might be easier said than done though.

Basically, any C nullptr should be mapped to a C++ empty string, and if it's not somewhere, there's probably a bug in the wrapping.



_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]