Re: Removing text from ComboBoxText



I have written this code

Glib::ustring us = nullptr;

Glib::ustring us1( nullptr );

And I am getting the same error. Reading the doc about this function

Glib::ustring Gtk::ComboBoxText::get_active_text() const

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

If combo_box contains an entry, this function will return its contents (which will not necessarily be an item from the list).

But constructing a Glib::ustring from a nullptr produces the error, so it could be a bug in the function.


I suggest to wrap the call with a try-catch and if this works fine, but I think it is a bug. I am compiling the version 3.18 of gtkmm to dig a little bit more.


On 29/05/2019 10:21, Mohamed Khalil BOUJDARIA wrote:
This is the error i get :
glibmm-ERROR **:
unhandled exception (type std::exception) in signal handler:
what: basic_string::_M_construct null not valid

Trace/breakpoint trap (core dumped)

Le mer. 29 mai 2019 à 10:20, Mohamed Khalil BOUJDARIA <khalil boujdaria gmail com> a écrit :
Hi,

Yes, it fails even when index is valid..

Le mer. 29 mai 2019 à 10:16, Carlos Gomez <carlos fgh co uk> a écrit :
Hi,

First thing is index always valid? I suggest you check it is different
from -1.

On 29/05/2019 09:45, Mohamed Khalil BOUJDARIA via gtkmm-list wrote:
> basic_string::_M_construct null not valid
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


--
Mohamed Khalil BOUJDARIA
Élève ingénieur en mécatronique
École nationale d'ingénieurs de Carthage
Tél : +21653283365/+21652054010


--
Mohamed Khalil BOUJDARIA
Élève ingénieur en mécatronique
École nationale d'ingénieurs de Carthage
Tél : +21653283365/+21652054010


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