<div dir="ltr">Hi there,<div><br></div><div>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.</div><div><br></div><div>I there created the following method and logic within vcl/unx/gtk3/gtkframe.cxx:</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;line-height:19px;white-space:pre"><div><div style="line-height:19px"><div><span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(78,201,176)">GtkSalFrame</span>::<span style="color:rgb(220,220,170)">initDefaultHeaderbar</span>(<span style="color:rgb(78,201,176)">GtkSalFrame</span><span style="color:rgb(86,156,214)">*</span> <span style="color:rgb(156,220,254)">cFrame</span>) {</div></div></div><br><div>    <span style="color:rgb(78,201,176)">GtkWidget</span>* <span style="color:rgb(156,220,254)">popMenu</span>;</div><br><div>    <span style="color:rgb(78,201,176)">SalMenu</span>* <span style="color:rgb(156,220,254)">pSalMenu</span> = <span style="color:rgb(220,220,170)">GetMenu</span>();</div><br><div>    <span style="color:rgb(197,134,192)">if</span> ( <span style="color:rgb(156,220,254)">pSalMenu</span> != <span style="color:rgb(86,156,214)">nullptr</span> )</div><div style="line-height:19px"><div>    {</div><div>         <span style="color:rgb(78,201,176)">GtkSalMenu</span>* <span style="color:rgb(156,220,254)">pGtkSalMenu</span> = <span style="color:rgb(86,156,214)">static_cast</span><<span style="color:rgb(78,201,176)">GtkSalMenu</span>*>(<span style="color:rgb(156,220,254)">pSalMenu</span>);</div><br><div>        <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">pGtkSalMenu</span> != <span style="color:rgb(86,156,214)">nullptr</span>) {</div><div>            <span style="color:rgb(78,201,176)">GMenuModel</span>* <span style="color:rgb(156,220,254)">menuNew</span> = <span style="color:rgb(86,156,214)">G_MENU_MODEL</span>(<span style="color:rgb(156,220,254)">pGtkSalMenu</span>-><span style="color:rgb(220,220,170)">GetMenuModel</span>());</div><div>            <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">menuNew</span> != <span style="color:rgb(86,156,214)">nullptr</span>)</div><div>            {</div><div>                <span style="color:rgb(156,220,254)">popMenu</span> = <span style="color:rgb(220,220,170)">gtk_popover_menu_bar_new_from_model</span>(<span style="color:rgb(86,156,214)">G_MENU_MODEL</span>(<span style="color:rgb(156,220,254)">menuNew</span>));</div><div>                <span style="color:rgb(220,220,170)">adw_header_bar_pack_start</span> (<span style="color:rgb(220,220,170)">ADW_HEADER_BAR</span>(<span style="color:rgb(156,220,254)">m_pHeaderBar</span>), <span style="color:rgb(86,156,214)">GTK_WIDGET</span>(<span style="color:rgb(156,220,254)">popMenu</span>));</div><div>            }</div><div><br></div><div><span style="color:rgb(106,153,85)">            </span><span style="color:rgb(106,153,85)">// popMenu = pGtkSalMenu->GetMenuBarWidget();</span></div><div style="line-height:19px"><br><div><span style="color:rgb(106,153,85)">            // if (popMenu != nullptr)</span></div><div><span style="color:rgb(106,153,85)">            // {</span></div><div><span style="color:rgb(106,153,85)">            //     adw_header_bar_pack_start (ADW_HEADER_BAR(m_pHeaderBar), popMenu);</span></div><div><span style="color:rgb(106,153,85)">            // }</span></div></div><div>        }</div><div>    }</div></div><div>}</div></div></div><div><br></div><div>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:</div><div>- pGtkSalMenu->GetMenuModel(): This is a getter I implented in vcl/inc/unx/gtk/gtksalmenu.hxx that return the mpMenuModel, see "<span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(78,201,176)">GMenuModel</span><span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(86,156,214)">*</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre"> </span><span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(220,220,170)">GetMenuModel</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre">() </span><span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(86,156,214)">const</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre"> { </span><span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(197,134,192)">return</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre"> </span><span style="background-color:rgb(30,30,30);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre;color:rgb(156,220,254)">mpMenuModel</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;white-space:pre">; }</span>". Once I call this method I get a Segmentation fault asĀ  result (see 1st screenshot below).</div><div>- 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).</div><div><br></div><div>Could you tell me why I would get a segmentation fault with this code?</div><div><br></div><div>I wish you Happy Holidays :)</div><div><br><br></div><div>Cheers,</div><div>Christian</div></div>