vcl/unx/gtk3/gtkframe.cxx: Segmentation fault on pGtkSalMenu->GetMenuBarWidget() OR pGtkSalMenu->GetMenuModel()

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

 



Hi there,

so what I currently want to do is getting the MenuBarWidget or the MenuModel from the pGtkSalMenu within the gtkframe, because I need it later on for filling the menubar in my Headerbar implementation.

I there created the following method and logic within vcl/unx/gtk3/gtkframe.cxx:

void GtkSalFrame::initDefaultHeaderbar(GtkSalFrame* cFrame) {

GtkWidget* popMenu;

SalMenu* pSalMenu = GetMenu();

if ( pSalMenu != nullptr )
{
GtkSalMenu* pGtkSalMenu = static_cast<GtkSalMenu*>(pSalMenu);

if (pGtkSalMenu != nullptr) {
GMenuModel* menuNew = G_MENU_MODEL(pGtkSalMenu->GetMenuModel());
if (menuNew != nullptr)
{
popMenu = gtk_popover_menu_bar_new_from_model(G_MENU_MODEL(menuNew));
adw_header_bar_pack_start (ADW_HEADER_BAR(m_pHeaderBar), GTK_WIDGET(popMenu));
}

// popMenu = pGtkSalMenu->GetMenuBarWidget();

// if (popMenu != nullptr)
// {
// adw_header_bar_pack_start (ADW_HEADER_BAR(m_pHeaderBar), popMenu);
// }
}
}
}

Independent of which way of implementing I use (either via MenuModel or MenuBarWidget (which is internally a PopoverMenubar), Dependent on which method I use, the following happens:
- pGtkSalMenu->GetMenuModel(): This is a getter I implented in vcl/inc/unx/gtk/gtksalmenu.hxx that return the mpMenuModel, see "GMenuModel* GetMenuModel() const { return mpMenuModel; }". Once I call this method I get a Segmentation fault as  result (see 1st screenshot below).
- pGtkSalMenu->GetMenuBarWidget(): Again, here I get a segmentation fault once I want to handly with the returned widget; it seems that the GTK_IS_WIDGET(popMenu) method returnd the segmentation fault (see the 2nd picture down below).

Could you tell me why I would get a segmentation fault with this code?

I wish you Happy Holidays :)


Cheers,
Christian

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux