focus-out-event on entry box asserts.



Hi,

I'm playing around with GTK-2.0.0 and have the following problem:
I'm trying to check the result of the contents of an gtk_entry control
when focus is lost. I've implemented the following signal handler:

g_signal_connect (G_OBJECT (edit_box),
                  "focus-out-event",
                  G_CALLBACK (LeaveEditBox),
                  NULL);

And the callback, which for now shows a messagebox, that is called when
the signal is emitted:

void LeaveEditBox (GtkWidget *widget, gpointer data)
{
  GtkWidget * msg_box;
  msg_box = gtk_message_dialog_new (GTK_WINDOW (root_window),
                                    GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_INFO,
                                    GTK_BUTTONS_OK,
                                    "Lost focus signal.");
 gtk_dialog_run (GTK_DIALOG (msg_box));
 gtk_widget_destroy (msg_box);
}

Now, when I switch from my entry field to another control, my messagebox
shows: perfect. But, when I press the OK button, my app asserts:

batch (pid:30678): Gtk-ERROR **: file gtkentry.c: line 4179 (blink_cb):
assertion failed: (GTK_WIDGET_HAS_FOCUS (entry))
aborting...
Aborted

A bt in gdb gives the following:

#0  0x40408971 in kill () from /lib/libc.so.6
#1  0x40408775 in raise () from /lib/libc.so.6
#2  0x40409da3 in abort () from /lib/libc.so.6
#3  0x4039be46 in g_logv (log_domain=0x401ef553 "Gtk",
log_level=G_LOG_LEVEL_ERROR, 
    format=0x401efb20 "file %s: line %d (%s): assertion failed: (%s)",
args1=0xbffff77c)
    at gmessages.c:555
#4  0x4039bef6 in g_log (log_domain=0x401ef553 "Gtk",
log_level=G_LOG_LEVEL_ERROR, 
    format=0x401efb20 "file %s: line %d (%s): assertion failed: (%s)")
at gmessages.c:574
#5  0x400b30f5 in blink_cb (data=0x8088a00) at gtkentry.c:4179
#6  0x40397020 in g_timeout_dispatch (source=0x8072898,
callback=0x400b3080 <blink_cb>, 
    user_data=0x8088a00) at gmain.c:2980
#7  0x40394991 in g_main_dispatch (context=0x805ab00) at gmain.c:1617
#8  0x403958a1 in g_main_context_dispatch (context=0x805ab00) at
gmain.c:2161
#9  0x40395c59 in g_main_context_iterate (context=0x805ab00, block=1,
dispatch=1, self=0x80d8fd8)
    at gmain.c:2242
#10 0x40396350 in g_main_loop_run (loop=0x80e8ce0) at gmain.c:2462
#11 0x400e3883 in gtk_main () at gtkmain.c:915
#12 0x0804968f in main ()
#13 0x403f65b0 in __libc_start_main () from /lib/libc.so.6

Ok, so then I tried to do the same trick except I connected my signal to
a button instead of the entry. Everything went perfect.

Have I done something wrong or should I head over to BugZilla?

Thank you in advance,

	Michel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]