diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index c4ca6d186..57790c9ad 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -1201,8 +1201,8 @@ void gApplication::enterLoop(void *owner, bool showIt, GtkWindow *modal) void gApplication::enterPopup(gMainWindow *owner) { - void *old_owner = _loop_owner; - int l = _loopLevel; + void *old_owner; + int l; //GtkWindowGroup *oldGroup; GtkWindow *window = GTK_WINDOW(owner->border); GtkWidget *old_popup_grab; @@ -1216,33 +1216,45 @@ void gApplication::enterPopup(gMainWindow *owner) gtk_window_set_modal(window, true); gdk_window_set_override_redirect(gtk_widget_get_window(owner->border), true); + owner->show(); - - old_popup_grab = _popup_grab; - _popup_grab = owner->border; - - if (_in_popup == 1) - gApplication::grabPopup(); - - _loopLevel++; - _loop_owner = owner; - - (*onEnterEventLoop)(); - do + + if (!owner->isDestroyed()) { - MAIN_do_iteration(false); + old_popup_grab = _popup_grab; + _popup_grab = owner->border; + + if (_in_popup == 1) + gApplication::grabPopup(); + + l = _loopLevel; + old_owner = _loop_owner; + + _loopLevel++; + _loop_owner = owner; + + (*onEnterEventLoop)(); + do + { + MAIN_do_iteration(false); + } + while (_loopLevel > l); + (*onLeaveEventLoop)(); + + gApplication::ungrabPopup(); + _popup_grab = old_popup_grab; + + _loop_owner = old_owner; + + if (owner->border) + { + gdk_window_set_override_redirect(gtk_widget_get_window(owner->border), false); + gtk_window_set_modal(window, false); + } + //exitGroup(oldGroup); } - while (_loopLevel > l); - (*onLeaveEventLoop)(); - - gApplication::ungrabPopup(); - _popup_grab = old_popup_grab; - - _loop_owner = old_owner; - - gdk_window_set_override_redirect(gtk_widget_get_window(owner->border), false); - gtk_window_set_modal(window, false); - //exitGroup(oldGroup); + else + gControl::cleanRemovedControls(); _in_popup--; } diff --git a/gb.gtk/src/gcombobox.cpp b/gb.gtk/src/gcombobox.cpp index ec704c877..928e4d7de 100644 --- a/gb.gtk/src/gcombobox.cpp +++ b/gb.gtk/src/gcombobox.cpp @@ -561,8 +561,8 @@ void gComboBox::updateFont() gControl::updateFont(); if (cell) g_object_set(G_OBJECT(cell), "font-desc", font()->desc(), (void *)NULL); -#ifdef GTK3 -#else +#ifndef GTK3 + else gtk_widget_modify_font(entry, font()->desc()); #endif } diff --git a/gb.gtk/src/gcontrol.cpp b/gb.gtk/src/gcontrol.cpp index d4bf3a853..1868c7dfb 100644 --- a/gb.gtk/src/gcontrol.cpp +++ b/gb.gtk/src/gcontrol.cpp @@ -422,7 +422,7 @@ void gControl::destroy() hide(); //fprintf(stderr, "added to destroy list: %p\n", this); - controls_destroyed = g_list_prepend(controls_destroyed,(gpointer)this); + controls_destroyed = g_list_prepend(controls_destroyed, (gpointer)this); _destroyed = true; } @@ -651,7 +651,7 @@ void gControl::resize(int w, int h) if (pr) pr->performArrange(); - send_configure(this); + //send_configure(this); } void gControl::moveResize(int x, int y, int w, int h)