Comment 2 for bug 907635

I think this is due to a missing NULL guard. The GTK+ docs say it's OK to gtk_menu_item_set_submenu(item, NULL) to remove the submenu, and I think Geany does this when reparenting the New with Templates menu item.

I've attached a patch that shows what I mean (against distro package source since current head wouldn't build here).