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

segv on exit from certain uimanager program



I get a segv from the program below when using the mouse to select
File/Quit.  This is on a recent debian i386 with gtk-perl 1.161, perl
5.8.8, gtk 2.12.1 and glib 2.14.3.

Sticking it under gdb shows it deep under gtk_ui_manager_finalize, with
"signal_emit_unlocked_R" apparently having got a bad "emission_list",
presumably on the destroy signal of some object within that uimanager.
But beyond that it's a mystery to me.

I struck this in my own program using a uimanager.  There seems to be
number of ways to avoid the problem,

    * use the keyboad to choose File/Quit (instead of the mouse)
    * Gtk2->main_quit instead of "exit 0"
    * don't hold the uimanager in $toplevel->{'ui'}
    * don't have an empty toolbar section in the ui spec

So maybe it's something subtle.  Very possibly it's unrelated to perl as
such -- I suppose in a C program nobody bothers to destroy objects when
exiting so who knows if their cleanups work!

use strict;
use warnings;
use Gtk2 '-init';

sub do_quit {
  exit 0;
}

my $toplevel = Gtk2::Window->new ('toplevel');

my $ui  = Gtk2::UIManager->new;
$toplevel->{'ui'} = $ui;
$toplevel->add_accel_group ($ui->get_accel_group);

my $actions = Gtk2::ActionGroup->new ("Actions");
$actions->add_actions
  ([ [ "FileMenu", undef,      "_File"                          ],
     [ "Quit",     'gtk-quit', undef,  undef, "Quit", \&do_quit ] ]);
$ui->insert_action_group ($actions, 0);

$ui->add_ui_from_string ("
<ui>
  <menubar name='MenuBar'>
    <menu action='FileMenu'>
      <menuitem action='Quit'/>
    </menu>
  </menubar>
  <toolbar  name='ToolBar'>
  </toolbar>
</ui>");

my $vbox = Gtk2::VBox->new (0,0);
$toplevel->add ($vbox);

my $menubar = $ui->get_widget('/MenuBar');
$vbox->pack_start ($menubar, 0,0,0);

$toplevel->set_default_size (400, 300);
$toplevel->show_all;
Gtk2->main;


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