Re: gtk-demo
- From: "Matthias Clasen" <matthiasc poet de>
- To: <gtk-devel-list gnome org>
- Subject: Re: gtk-demo
- Date: Mon, 20 Aug 2001 12:31:59 +0200
I already put a similar patch in #58161.
Maybe you have more luck with getting a green light for commit ...
----- Original Message -----
From: "Padraig O'Briain" <Padraig Obriain Sun COM>
To: <gtk-devel-list gnome org>
Sent: Monday, August 20, 2001 12:23 PM
Subject: gtk-demo
> If I run gtk-demo and double click on Application main window and then
close
> that window I get messages such as those below.
>
> gtk-demo (pid:16775): GRuntime-WARNING **: invalid cast from `PangoLayout'
to
> `GtkStatusbar'
>
> gtk-demo (pid:16775): Gtk-CRITICAL **: file gtkstatusbar.c: line 278
> (gtk_statusbar_pop): assertion `GTK_IS_STATUSBAR (statusbar)' failed
>
> gtk-demo (pid:16775): Gtk-CRITICAL **: file gtkstatusbar.c: line 253
> (gtk_statusbar_push): assertion `GTK_IS_STATUSBAR (statusbar)' failed
>
> May I commit the following change to fix the problem?
>
> Padraig
>
>
> Index: appwindow.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/demos/gtk-demo/appwindow.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 appwindow.c
> --- appwindow.c 2001/07/31 09:42:34 1.4
> +++ appwindow.c 2001/08/20 10:22:45
> @@ -6,8 +6,10 @@
> #include <gtk/gtk.h>
>
> static GtkWidget *window = NULL;
> +static guint changed_id;
> +static guint mark_set_id;
> +static GObject *text_buffer;
>
> -
> static void
> menuitem_cb (gpointer callback_data,
> guint callback_action,
> @@ -147,7 +149,7 @@ update_statusbar (GtkTextBuffer *buffer,
> gint row, col;
> gint count;
> GtkTextIter iter;
> -
> +
> gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
underflow is
> allowed */
>
> count = gtk_text_buffer_get_char_count (buffer);
> @@ -176,6 +178,16 @@ mark_set_callback (GtkTextBuffer *bu
> update_statusbar (buffer, GTK_STATUSBAR (data));
> }
>
> +static void
> +destroy_statusbar (GtkStatusbar *statusbar)
> +{
> + /*
> + * Remove signals which use statusbar when statusbar is destroyed.
> + */
> + g_signal_handler_disconnect (text_buffer, changed_id);
> + g_signal_handler_disconnect (text_buffer, mark_set_id);
> +}
> +
> GtkWidget *
> do_appwindow (void)
>
> @@ -302,6 +314,10 @@ do_appwindow (void)
> /* Create statusbar */
>
> statusbar = gtk_statusbar_new ();
> + g_signal_connect (G_OBJECT (statusbar),
> + "destroy",
> + G_CALLBACK (destroy_statusbar),
> + NULL);
> gtk_table_attach (GTK_TABLE (table),
> statusbar,
> /* X direction */ /* Y direction */
> @@ -311,16 +327,17 @@ do_appwindow (void)
>
> /* Show text widget info in the statusbar */
> buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
> -
> - g_signal_connect (G_OBJECT (buffer),
> - "changed",
> - G_CALLBACK (update_statusbar),
> - statusbar);
> -
> - g_signal_connect (G_OBJECT (buffer),
> - "mark_set", /* cursor moved */
> - G_CALLBACK (mark_set_callback),
> - statusbar);
> + text_buffer = G_OBJECT (buffer);
> +
> + changed_id = g_signal_connect (G_OBJECT (buffer),
> + "changed",
> + G_CALLBACK (update_statusbar),
> + statusbar);
> +
> + mark_set_id = g_signal_connect (G_OBJECT (buffer),
> + "mark_set", /* cursor moved */
> + G_CALLBACK (mark_set_callback),
> + statusbar);
>
> update_statusbar (buffer, GTK_STATUSBAR (statusbar));
> }
>
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]