Do not crash anymore when deleting a modal window during its Open event.

[GB.GTK]
* BUG: Do not crash anymore when deleting a modal window during its Open event.
* BUG: Don't send fake configure event anymore when resizing a control. To check if it is actually needed for something.

[GB.GTK3]
* BUG: Do not crash anymore when deleting a modal window during its Open event.
* BUG: Don't send fake configure event anymore when resizing a control. To check if it is actually needed for something.
This commit is contained in:
gambas 2018-09-14 00:47:32 +02:00
parent 02a5a7e653
commit 1cf0e4bfeb
3 changed files with 42 additions and 30 deletions

View file

@ -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--;
}

View file

@ -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
}

View file

@ -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)