disconnect the response handler to avoid that the query_box callback is

2004-03-06  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpquerybox.c (query_box_disconnect): disconnect
	the response handler to avoid that the query_box callback is being
	called multiple times. Fixes bug #136371.
This commit is contained in:
Sven Neumann 2004-03-06 17:42:56 +00:00 committed by Sven Neumann
parent 35fe294010
commit 6fd723103a
2 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2004-03-06 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpquerybox.c (query_box_disconnect): disconnect
the response handler to avoid that the query_box callback is being
called multiple times. Fixes bug #136371.
2004-03-05 Sven Neumann <sven@gimp.org>
* plug-ins/common/plasma.c (add_random): check random range before

View File

@ -49,6 +49,7 @@ struct _QueryBox
GtkWidget *vbox;
GtkWidget *entry;
GObject *object;
gulong response_handler;
GCallback callback;
gpointer callback_data;
};
@ -128,9 +129,10 @@ create_query_box (const gchar *title,
NULL);
g_signal_connect (query_box->qbox, "response",
G_CALLBACK (response_callback),
query_box);
query_box->response_handler =
g_signal_connect (query_box->qbox, "response",
G_CALLBACK (response_callback),
query_box);
g_signal_connect (query_box->qbox, "destroy",
G_CALLBACK (gtk_widget_destroyed),
@ -518,6 +520,15 @@ query_box_disconnect (QueryBox *query_box)
{
gtk_widget_set_sensitive (query_box->qbox, FALSE);
/* disconnect the response callback to avoid that it may be run twice */
if (query_box->response_handler)
{
g_signal_handler_disconnect (query_box->qbox,
query_box->response_handler);
query_box->response_handler = 0;
}
/* disconnect, if we are connected to some signal */
if (query_box->object)
g_signal_handlers_disconnect_by_func (query_box->object,