[PHP-BUG] Bug #54427 [NEW]: Segfault when emiting custom signal with object parameter

[email protected] ("ptlis at ptlis dot net") Wed, 30 Mar 2011 19:01:10 +0200 (CEST)
Newsgroups php.gtk.dev
Message-ID <[email protected]>
From:             
Operating system: Ubuntu 10.4
PHP version:      5.3.6
Package:          PHP-GTK related
Bug Type:         Bug
Bug description:Segfault when emiting custom signal with object parameter

Description:
------------
The first time the OK button on the dialog is clicked the custom signal is
emitted correctly, on the second click php segfaults on the call to
emit().

If no object is provided to emit() the second signal emits without segfault
as expected.

Test script:
---------------
<?php

/**	Class implements custom signal 'product-ready'. */
	class customDialog extends GtkDialog {
	    public $__gsignals	= array(
            		'product-ready'  => array(
	    				GObject::SIGNAL_RUN_LAST,
	    				GObject::TYPE_BOOLEAN,
	    				array(
	    					GObject::TYPE_PHP_VALUE
	    				)
	    			)
				);

		public function __construct($title, GtkWindow $parent) {
			parent::__construct($title, $parent, Gtk::DIALOG_MODAL);

			$product	= new stdClass();

			$okButton	= new GtkButton('OK');
			$this->action_area->add($okButton);
			$okButton->connect_simple('clicked', array($this, 'ok_clicked'),
$product);
		}

		public function ok_clicked(stdClass $product) {
			$this->emit('product-ready', $product);
		}
	}
	GObject::register_type('customDialog');



	$window	= new GtkWindow();
	$window->show_all();

	$dialog	= new customDialog('fire signal dialog', $window);
	$dialog->show_all();

	$dialog->connect('product-ready', 'product_ready');

	function product_ready() {
		echo 'segfaults on second signal' . "\n";
		return true;
	}

	Gtk::main();


-- 
Edit bug report at http://bugs.php.net/bug.php?id=54427&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=54427&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=54427&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=54427&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=54427&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54427&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=54427&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=54427&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=54427&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=54427&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=54427&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=54427&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=54427&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=54427&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=54427&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54427&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54427&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=54427&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=54427&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=54427&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=54427&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=54427&r=mysqlcfg