forked from AuroraMiddleware/gtk
colordialogbutton: Survive window closing
If the parent window of the button gets destroyed while the dialog is open, we cancel the async op, but we need to be a little more careful about not stepping on glass.
This commit is contained in:
parent
b297baed32
commit
637ef84d04
@ -338,8 +338,9 @@ drag_prepare (GtkDragSource *source,
|
|||||||
static void
|
static void
|
||||||
update_button_sensitivity (GtkColorDialogButton *self)
|
update_button_sensitivity (GtkColorDialogButton *self)
|
||||||
{
|
{
|
||||||
gtk_widget_set_sensitive (self->button,
|
if (self->button)
|
||||||
self->dialog != NULL && self->cancellable == NULL);
|
gtk_widget_set_sensitive (self->button,
|
||||||
|
self->dialog != NULL && self->cancellable == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -347,10 +348,11 @@ color_chosen (GObject *source,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
GtkColorDialog *dialog = GTK_COLOR_DIALOG (source);
|
||||||
GtkColorDialogButton *self = data;
|
GtkColorDialogButton *self = data;
|
||||||
GdkRGBA *color;
|
GdkRGBA *color;
|
||||||
|
|
||||||
color = gtk_color_dialog_choose_rgba_finish (self->dialog, result, NULL);
|
color = gtk_color_dialog_choose_rgba_finish (dialog, result, NULL);
|
||||||
if (color)
|
if (color)
|
||||||
{
|
{
|
||||||
gtk_color_dialog_button_set_rgba (self, color);
|
gtk_color_dialog_button_set_rgba (self, color);
|
||||||
|
Loading…
Reference in New Issue
Block a user