[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: action->get_proxies during connect-proxy emit
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: Re: action->get_proxies during connect-proxy emit
- Date: Fri, 19 Sep 2008 10:49:57 +1000
Test case and what I did about it below. get_proxies isn't a
constructor, so if I'm not mistaken its object returns shouldn't be
subject to ref_sink.
But I don't know if this is enough. In particular I turned on NOISY in
GtkObject.xs and it got a segv ... but perhaps that's something else.
--- GtkAction.xs 16 Sep 2007 00:33:02 +1000 1.10
+++ GtkAction.xs 18 Sep 2008 17:23:10 +1000
@@ -43,7 +43,7 @@
GSList * i;
PPCODE:
for (i = gtk_action_get_proxies (action) ; i != NULL ; i = i->next)
- XPUSHs (sv_2mortal (newSVGtkWidget (i->data)));
+ XPUSHs (sv_2mortal (gperl_new_object (G_OBJECT (i->data), FALSE)));
void gtk_action_connect_accelerator (GtkAction *action);
--- GtkAction.t 16 Sep 2007 00:32:59 +1000 1.12
+++ GtkAction.t 18 Sep 2008 17:27:40 +1000
@@ -4,7 +4,7 @@
use Gtk2::TestHelper
at_least_version => [2, 4, 0, "Action-based menus are new in 2.4"],
- tests => 18, noinit => 0;
+ tests => 19, noinit => 0;
my $action = Gtk2::Action->new (name => 'Open',
label => '_Open',
@@ -58,6 +58,37 @@
$action->set_accel_group (undef);
$action->set_accel_group (Gtk2::AccelGroup->new);
+# call $action->get_proxies within an ActionGroup connect_proxy signal, to
+# check the ref-counting/sinking/not-sinking on that get_proxies is ok there.
+{
+ my $actions = Gtk2::ActionGroup->new ("Actions");
+ $actions->add_actions
+ ([ [ 'FileMenu', undef, '_File' ] ]);
+ $actions->signal_connect (connect_proxy => \&connect_get_proxies);
+ my $proxies_called = 0;
+ sub connect_get_proxies {
+ my ($actions, $action, $widget) = @_;
+ $action->get_proxies;
+ $proxies_called++;
+ }
+ my $ui = Gtk2::UIManager->new;
+ $ui->insert_action_group ($actions, 0);
+ $ui->add_ui_from_string (<<'HERE');
+<ui>
+ <menubar name='MenuBar'>
+ <menu action='FileMenu'>
+ </menu>
+ </menubar>
+</ui>
+HERE
+ # dodgy refs result in g_critical logs
+ my $old_fatal = Glib::Log->set_always_fatal (['critical', 'fatal-mask']);
+ $ui->get_widget('/MenuBar');
+ Glib::Log->set_always_fatal ($old_fatal);
+ is ($proxies_called, 1,
+ '$action->get_proxies ok under a connect_proxy signal');
+}
+
SKIP: {
skip "new 2.6 stuff", 3
unless Gtk2->CHECK_VERSION (2, 6, 0);
--
The sigfile one-line movie reviews series:
"Children of a Lesser God" -- great title, terrible movie.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]