Tasking with GtkAda

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tasking with GtkAda

Oliver Kellogg-3
Hello,

We followed the advice given at

http://docs.adacore.com/gtkada-docs/gtkada_ug/_build/html/tasking.html

but still found that our program would crash after a varying amount of time, at varying places (usually ending somewhere in libpango).

All backtraces had in common that recompute_idle_func() was involved.
Here is an example backtrace:

(sns_main:2426): Pango-CRITICAL **: pango_layout_line_get_extents: assertion 'LINE_IS_VALID (line)' failed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff57b5955 in pango_context_get_font_description () from /lib64/libpango-1.0.so.0
(gdb) bt
#0  0x00007ffff57b5955 in pango_context_get_font_description () from /lib64/libpango-1.0.so.0
#1  0x00007ffff57ba4c8 in pango_layout_get_empty_extents_at_index () from /lib64/libpango-1.0.so.0
#2  0x00007ffff57bd175 in pango_layout_line_get_extents () from /lib64/libpango-1.0.so.0
#3  0x00007ffff69d3a66 in gtk_entry_adjust_scroll () from /lib64/libgtk-3.so.0
#4  0x00007ffff69d5190 in recompute_idle_func () from /lib64/libgtk-3.so.0
#5  0x00007ffff65e66b8 in gdk_threads_dispatch () from /lib64/libgdk-3.so.0
#6  0x00007ffff4d34d7a in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#7  0x00007ffff4d350b8 in g_main_context_iterate.isra () from /lib64/libglib-2.0.so.0
#8  0x00007ffff4d3538a in g_main_loop_run () from /lib64/libglib-2.0.so.0
#9  0x00007ffff6a4d045 in gtk_main () from /lib64/libgtk-3.so.0

Our program makes GUI widget update calls from Ada tasks.

We changed the program so that the Ada tasks put their widget update requests into a protected-object based queue, and in the main program we call Glib.Main.Timeout_Add with a function that reads from this queue and executes the requests.
Since that change, our tasking program has been running without crash.

Oliver





_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada

_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Reply | Threaded
Open this post in threaded view
|

Re: Tasking with GtkAda

Dmitry A. Kazakov
On 17/03/2017 01:41, Oliver Kellogg wrote:

> We changed the program so that the Ada tasks put their widget update
> requests into a protected-object based queue,

You cannot use a queue because in a large number of cases return values
and side effects are needed at the caller's point.

The protected object must act rather as a rendezvous with the main task.

P.S. It would be nice if GtkAda generated wrappers checked if the
caller's task ID is one of the main task and otherwise used a
wait-for-timer mechanism. At least they could drop an exception.
However, I understand it might be too much work.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada
Reply | Threaded
Open this post in threaded view
|

Re: Tasking with GtkAda

bertus.dries
In reply to this post by Oliver Kellogg-3
I don't know if what I have to say is of any importance to you, But I do
have an workig program under Windows using GTKAda and tasking. I have done
nothing with the aid of chapter 8 (Tasking with GtkAda). What I have been
doing is simply putall GtkAda in one task, in my case the basic task and let
all othertasks communicate withthis task.

L. Dries

-----Oorspronkelijk bericht-----
From: Oliver Kellogg
Sent: Friday, March 17, 2017 1:41 AM
To: [hidden email]
Subject: [gtkada] Tasking with GtkAda

Hello,

We followed the advice given at

http://docs.adacore.com/gtkada-docs/gtkada_ug/_build/html/tasking.html

but still found that our program would crash after a varying amount of time,
at varying places (usually ending somewhere in libpango).

All backtraces had in common that recompute_idle_func() was involved.
Here is an example backtrace:

(sns_main:2426): Pango-CRITICAL **: pango_layout_line_get_extents: assertion
'LINE_IS_VALID (line)' failed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff57b5955 in pango_context_get_font_description () from
/lib64/libpango-1.0.so.0
(gdb) bt
#0  0x00007ffff57b5955 in pango_context_get_font_description () from
/lib64/libpango-1.0.so.0
#1  0x00007ffff57ba4c8 in pango_layout_get_empty_extents_at_index () from
/lib64/libpango-1.0.so.0
#2  0x00007ffff57bd175 in pango_layout_line_get_extents () from
/lib64/libpango-1.0.so.0
#3  0x00007ffff69d3a66 in gtk_entry_adjust_scroll () from
/lib64/libgtk-3.so.0
#4  0x00007ffff69d5190 in recompute_idle_func () from /lib64/libgtk-3.so.0
#5  0x00007ffff65e66b8 in gdk_threads_dispatch () from /lib64/libgdk-3.so.0
#6  0x00007ffff4d34d7a in g_main_context_dispatch () from
/lib64/libglib-2.0.so.0
#7  0x00007ffff4d350b8 in g_main_context_iterate.isra () from
/lib64/libglib-2.0.so.0
#8  0x00007ffff4d3538a in g_main_loop_run () from /lib64/libglib-2.0.so.0
#9  0x00007ffff6a4d045 in gtk_main () from /lib64/libgtk-3.so.0

Our program makes GUI widget update calls from Ada tasks.

We changed the program so that the Ada tasks put their widget update
requests into a protected-object based queue, and in the main program we
call Glib.Main.Timeout_Add with a function that reads from this queue and
executes the requests.
Since that change, our tasking program has been running without crash.

Oliver





_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada

_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada 

_______________________________________________
gtkada mailing list
[hidden email]
http://lists.adacore.com/mailman/listinfo/gtkada