gtkmm4: problems when using stack->get_pages()
I am facing problems while trying to get the pages of a stack with stack->get_pages()
. This crashes with a segmentation fault
auto item = std::dynamic_pointer_cast<Gio::ListModel>(stack->get_pages())->get_object(0);
while this works fine without crashes
auto* page = g_list_model_get_item(G_LIST_MODEL(stack->get_pages()->gobj()), 0)
On other occasions I have also faced what seems to be some strange lifetime issues with the model returned by stack->get_pages(). When trying to use signal_selection_changed
I have to save a pointer to the returned model as a class member for the signal to be triggered. Even if the stack is still alive.
I am not sure about what I am doing wrong.
Edited by Wellington Wallace