I get a strange error in my
program using windown0.98 and PHP-GTK 0.5.2
I made a menubar with some
submenus. Nothing wrong with it even when I create a statusbar. But... when I
connect the GtkMenuItem select and deselect signals ...
$menuitem1->connect_object('select','showStatus',
'menuitem1');
$menuitem1->connect_object('deselect','hideStatus');
$menuitem1->connect_object('deselect','hideStatus');
... with the following two
functions:
function
showStatus($key)
{
global $status,$statusbar;
// $status is just an array with the descriptions to show
{
global $status,$statusbar;
// $status is just an array with the descriptions to show
// I tried to use
get_context_id(), but the error still occurs
$statusbar->push(1,$status[$key]);
while (gtk::events_pending())
gtk::main_iteration();
}
function hideStatus()
{
global $statusbar;
$statusbar->pop(1);
}
while (gtk::events_pending())
gtk::main_iteration();
}
function hideStatus()
{
global $statusbar;
$statusbar->pop(1);
}
The program crashes. It gaves
me the following output:
Error:
(program.php:4294197997): Gtk-WARNING **: invalid cast from (NULL) pointer to
`GtkMenuItem'
When does the crash
occur:
The crash seems to occur only
when you click with your mouse on an item (an item of the menubar, not a
menu) and THEN uses the arrows of your keyboard to go to another submenu.
If you only use the mouse, the crash seems to occur only when you move the mouse
very fast over the items of the menubar (sometimes).
When I comment the connections
the error doesn't occur anymore. But that way, my statusbar is totally empty!
How can I fix this?