Revert "app: remove all deprecated threads_enter/leave code"

This reverts commit 94b028bc39c7250997ee9883793e6649bf2490c7.

Dunno what breaks here, it just crashes, leave the commits there
instead of rebasing them away, as reminder...
This commit is contained in:
Michael Natterer 2018-05-02 16:14:54 +02:00
parent 579cf4c428
commit b9103bbc5f
6 changed files with 54 additions and 3 deletions

View File

@ -392,7 +392,6 @@ app_run (const gchar *full_prog_name,
g_object_unref (file);
}
}
/* Delete backup XCF images. */
for (iter = recovered_files; iter; iter = iter->next)
{
@ -420,7 +419,6 @@ app_run (const gchar *full_prog_name,
}
}
}
if (font_error)
{
gimp_message_literal (gimp, NULL,
@ -433,7 +431,11 @@ app_run (const gchar *full_prog_name,
gimp_batch_run (gimp, batch_interpreter, batch_commands);
if (run_loop)
g_main_loop_run (loop);
{
gimp_threads_leave (gimp);
g_main_loop_run (loop);
gimp_threads_enter (gimp);
}
if (gimp->be_verbose)
g_print ("EXIT: %s\n", G_STRFUNC);

View File

@ -42,6 +42,8 @@ gimp_gui_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->gui.ungrab = NULL;
gimp->gui.threads_enter = NULL;
gimp->gui.threads_leave = NULL;
gimp->gui.set_busy = NULL;
gimp->gui.unset_busy = NULL;
gimp->gui.show_message = NULL;
@ -76,6 +78,24 @@ gimp_gui_ungrab (Gimp *gimp)
gimp->gui.ungrab (gimp);
}
void
gimp_threads_enter (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.threads_enter)
gimp->gui.threads_enter (gimp);
}
void
gimp_threads_leave (Gimp *gimp)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimp->gui.threads_leave)
gimp->gui.threads_leave (gimp);
}
void
gimp_set_busy (Gimp *gimp)
{

View File

@ -25,6 +25,9 @@ struct _GimpGui
{
void (* ungrab) (Gimp *gimp);
void (* threads_enter) (Gimp *gimp);
void (* threads_leave) (Gimp *gimp);
void (* set_busy) (Gimp *gimp);
void (* unset_busy) (Gimp *gimp);
@ -109,6 +112,9 @@ void gimp_gui_init (Gimp *gimp);
void gimp_gui_ungrab (Gimp *gimp);
void gimp_threads_enter (Gimp *gimp);
void gimp_threads_leave (Gimp *gimp);
GimpObject * gimp_get_window_strategy (Gimp *gimp);
GimpObject * gimp_get_empty_display (Gimp *gimp);
GimpObject * gimp_get_display_by_ID (Gimp *gimp,

View File

@ -87,6 +87,9 @@
static void gui_ungrab (Gimp *gimp);
static void gui_threads_enter (Gimp *gimp);
static void gui_threads_leave (Gimp *gimp);
static void gui_set_busy (Gimp *gimp);
static void gui_unset_busy (Gimp *gimp);
@ -164,6 +167,8 @@ gui_vtable_init (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp->gui.ungrab = gui_ungrab;
gimp->gui.threads_enter = gui_threads_enter;
gimp->gui.threads_leave = gui_threads_leave;
gimp->gui.set_busy = gui_set_busy;
gimp->gui.unset_busy = gui_unset_busy;
gimp->gui.show_message = gui_message;
@ -207,6 +212,18 @@ gui_ungrab (Gimp *gimp)
}
}
static void
gui_threads_enter (Gimp *gimp)
{
GDK_THREADS_ENTER ();
}
static void
gui_threads_leave (Gimp *gimp)
{
GDK_THREADS_LEAVE ();
}
static void
gui_set_busy (Gimp *gimp)
{

View File

@ -784,7 +784,9 @@ gimp_plug_in_main_loop (GimpPlugIn *plug_in)
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (plug_in->manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (plug_in->manager->gimp);
g_clear_pointer (&proc_frame->main_loop, g_main_loop_unref);
}

View File

@ -256,7 +256,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
{
plug_in->ext_main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (manager->gimp);
g_main_loop_run (plug_in->ext_main_loop);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in gimp_plug_in_handle_extension_ack() */
@ -272,7 +274,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
proc_frame->main_loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (manager->gimp);
g_main_loop_run (proc_frame->main_loop);
gimp_threads_enter (manager->gimp);
/* main_loop is quit in gimp_plug_in_handle_proc_return() */