Segfault on toggle callback with GtkCheckButton
| Newsgroups | php.gtk.general |
|---|---|
| Message-ID | <30623737.477801202429130949.JavaMail.servlet@perfora> |
Hi All,
I'm new to PHP-GTK, but I've got a fairly strong background using gtk and C. I've been attempting to set up a callback function that is called whenever a GtkCheckButton is toggled, but I'm getting a segfault every time. I've reproduced the crash in the below code.
This is running on Ubuntu 7.10/Gutsy using the Ubuntu 5.2.3 php5-cli executable.
Any ideas? xdebug isn't giving me any stacktrace on the segfault, so I assume that means the php executable itself is crashing.
Thanks,
-- Alex Augot
///////////////////////////
Code
///////////////////////////
<?php
// Toggle Button Crash Test
class testClass
{
private $gtkButton;
public function createButton()
{
$this->gtkButton = new GtkCheckButton("My Label");
$this->gtkButton->connect_simple('toggled', array($this, 'selectedEvent'));
}
public function getButton() { return $this->gtkButton; }
public function selectedEvent()
{
if($this->gtkButton->get_active())
$this->gtkButton->set_active(false);
else
$this->gtkButton->set_active(true);
}
}
// Create the test button
$testButton = new testClass();
$testButton->createButton();
// Create a test window, hbox, and add
// the button to it. When button is toggled, it segfaults
$gtkWindow = new GtkWindow();
$gtkBox = new GtkHBox();
$gtkWindow->add($gtkBox);
$gtkBox->add($testButton->getButton());
$gtkWindow->set_visible(true);
Gtk::main();
?>