Minimal example to connect a Layout/Edje signal:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
using efl::eo::instantiate;
using namespace std;
void allFunc2(efl::layout::Signal s, efl::eina::basic_string_view<char> emmision, efl::eina::basic_string_view<char> source)
{
cout << "allFunc2(): " << emmision << " / " << source << endl;
}
static void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
efl::ui::Win window(instantiate);
window.autohide_set(true);
efl::ui::Layout layout(instantiate, window);
layout.file_set("glowing.edj");
layout.key_set("glowing");
layout.signal_callback_add("edje", "func", &allFunc2);
layout.load();
window.text_set("Layout Example");
window.size_set({320,160});
window.content_set(layout);
}
EFL_MAIN()
This is gdb output:
Starting program: /home/andreas/src/efl/beispiele/elementary_layout_cxx_example1/elementary_layout_cxx_example1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff50b2700 (LWP 592627)]
[New Thread 0x7ffff48b1700 (LWP 592628)]
[New Thread 0x7ffff40b0700 (LWP 592629)]
[Thread 0x7ffff40b0700 (LWP 592629) exited]
malloc_consolidate(): invalid chunk size
Thread 1 "elementary_layo" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff744c859 in __GI_abort () at abort.c:79
#2 0x00007ffff74b73ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff75e1285 "%s\n")
at ../sysdeps/posix/libc_fatal.c:155
#3 0x00007ffff74bf47c in malloc_printerr (str=str@entry=0x7ffff75e3278 "malloc_consolidate(): invalid chunk size")
at malloc.c:5347
#4 0x00007ffff74bfc58 in malloc_consolidate (av=av@entry=0x7ffff7612b80 <main_arena>) at malloc.c:4477
#5 0x00007ffff74c1e03 in _int_malloc (av=av@entry=0x7ffff7612b80 <main_arena>, bytes=bytes@entry=1088) at malloc.c:3699
#6 0x00007ffff74c5d15 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:3428
#7 0x00007ffff63ffb7a in ?? () from /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0
#8 0x00007ffff6400124 in hb_ft_font_create () from /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0
#9 0x00007ffff6fc15f5 in _evas_common_font_ot_shape () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#10 0x00007ffff6fc17d2 in evas_common_font_ot_populate_text_props () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#11 0x00007ffff6fc0128 in _content_create_ot () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#12 0x00007ffff6fc0560 in evas_common_text_props_content_create () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#13 0x00007ffff6f48dcd in eng_font_text_props_info_create () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#14 0x00007ffff7054b1e in _evas_object_text_item_new () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#15 0x00007ffff70555b0 in _evas_object_text_layout () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#16 0x00007ffff705ba82 in _evas_object_text_recalc () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#17 0x00007ffff70564a7 in _evas_text_efl_text_text_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#18 0x00007ffff724e910 in efl_text_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#19 0x00007ffff6e2a8d8 in _edje_text_fit_x () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#20 0x00007ffff6e2bd90 in _edje_text_recalc_apply () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#21 0x00007ffff6d73502 in _edje_part_recalc_single_text () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#22 0x00007ffff6d77535 in _edje_part_recalc_single () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#23 0x00007ffff6d7ac30 in _edje_part_recalc () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#24 0x00007ffff6d719aa in _edje_recalc_table_parts () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#25 0x00007ffff6d71abb in _edje_recalc_do () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#26 0x00007ffff6e26681 in _efl_canvas_layout_efl_gfx_entity_size_set () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#27 0x00007ffff7258f39 in efl_gfx_entity_size_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#28 0x00007ffff7027414 in _efl_canvas_object_efl_gfx_entity_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#29 0x00007ffff72591c2 in efl_gfx_entity_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#30 0x00007ffff70274ce in evas_object_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#31 0x00007ffff7d788ea in _elm_win_resize_job () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#32 0x00007ffff7d7d630 in _efl_ui_win_show () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#33 0x00007ffff7d7da65 in _efl_ui_win_efl_gfx_entity_visible_set () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#34 0x00007ffff7259528 in efl_gfx_entity_visible_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#35 0x00007ffff70abeb1 in evas_render_pre () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#36 0x00007ffff70ac030 in evas_render_pending_objects_flush () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#37 0x00007ffff7d84796 in _win_finalize_job_cb () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#38 0x00007ffff73b9acb in _eina_future_cb_easy () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#39 0x00007ffff73b693f in _eina_future_cb_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#40 0x00007ffff73b6a71 in _eina_future_dispatch_internal () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#41 0x00007ffff73b6b87 in _eina_future_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#42 0x00007ffff73b6d11 in _eina_future_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#43 0x00007ffff73b6ded in _scheduled_entry_cb () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#44 0x00007ffff7831d17 in _futures_dispatch_cb () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#45 0x00007ffff78329f9 in _event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#46 0x00007ffff7832c0a in _efl_object_event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#47 0x00007ffff7832cc7 in efl_event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#48 0x00007ffff786b56a in _ecore_main_loop_iterate_internal () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#49 0x00007ffff7868a07 in _ecore_main_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#50 0x00007ffff7870d13 in _efl_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#51 0x00007ffff78732d6 in efl_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#52 0x0000555555556fda in main (argc=1, argv=0x7fffffffd508) at elementary_layout_cxx_example1.cpp:43
valgrind output:
> valgrind ./elementary_layout_cxx_example1
==593080== Memcheck, a memory error detector
==593080== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==593080== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==593080== Command: ./elementary_layout_cxx_example1
==593080==
==593080== Invalid free() / delete / delete[] / realloc()
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Address 0xbcb6210 is 0 bytes inside a block of size 8 free'd
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Block was alloc'd at
==593080== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10BD09: bool eo_cxx::efl::layout::Signal::signal_callback_add<void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)>(efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >, void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)) const (efl_layout_signal.eo.impl.hh:60)
==593080== by 0x10AE0A: efl_main(void*, _Efl_Event const*) (elementary_layout_cxx_example1.cpp:30)
==593080== by 0x4FEAAA1: _event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEAC09: _efl_object_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEACC6: efl_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4F4AA2D: _efl_loop_arguments_send (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4FEC187: _efl_future_cb (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x543893E: _eina_future_cb_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438A70: _eina_future_dispatch_internal (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438B86: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438D10: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080==
ERROR: ecore_animator thread - epoll_wait(..., 200) at 273256.86684 should have slept ~ 0.01667s but took 0.03607s!
q
^C==593080== Invalid free() / delete / delete[] / realloc()
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5AA2E65: _edje_signal_callback_free (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A6D4D2: _edje_del (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A6D91C: _edje_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7DE9F: _efl_canvas_layout_efl_canvas_group_group_del (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5741B99: efl_canvas_group_del (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x57402B7: evas_object_smart_del (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x572813A: _efl_canvas_object_efl_object_invalidate (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x4FEE5C9: efl_invalidate (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x5A7D7E3: _efl_canvas_layout_efl_object_invalidate (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== Address 0xbcb6210 is 0 bytes inside a block of size 8 free'd
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Block was alloc'd at
==593080== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10BD09: bool eo_cxx::efl::layout::Signal::signal_callback_add<void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)>(efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >, void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)) const (efl_layout_signal.eo.impl.hh:60)
==593080== by 0x10AE0A: efl_main(void*, _Efl_Event const*) (elementary_layout_cxx_example1.cpp:30)
==593080== by 0x4FEAAA1: _event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEAC09: _efl_object_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEACC6: efl_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4F4AA2D: _efl_loop_arguments_send (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4FEC187: _efl_future_cb (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x543893E: _eina_future_cb_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438A70: _eina_future_dispatch_internal (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438B86: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438D10: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080==
==593080==
==593080== HEAP SUMMARY:
==593080== in use at exit: 90,558 bytes in 999 blocks
==593080== total heap usage: 129,668 allocs, 103,481 frees, 48,345,424 bytes allocated
==593080==
==593080== LEAK SUMMARY:
==593080== definitely lost: 95 bytes in 1 blocks
==593080== indirectly lost: 0 bytes in 0 blocks
==593080== possibly lost: 0 bytes in 0 blocks
==593080== still reachable: 90,463 bytes in 998 blocks
==593080== suppressed: 0 bytes in 0 blocks
==593080== Rerun with --leak-check=full to see details of leaked memory
==593080==
==593080== For lists of detected and suppressed errors, rerun with: -s
==593080== ERROR SUMMARY: 424 errors from 2 contexts (suppressed: 0 from 0)
```
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
using efl::eo::instantiate;
using namespace std;
void allFunc2(efl::layout::Signal s, efl::eina::basic_string_view<char> emmision, efl::eina::basic_string_view<char> source)
{
cout << "allFunc2(): " << emmision << " / " << source << endl;
}
static void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
efl::ui::Win window(instantiate);
window.autohide_set(true);
efl::ui::Layout layout(instantiate, window);
layout.file_set("glowing.edj");
layout.key_set("glowing");
layout.signal_callback_add("edje", "func", &allFunc2);
layout.load();
window.text_set("Layout Example");
window.size_set({320,160});
window.content_set(layout);
}
EFL_MAIN()
```
This is gdb output:
Starting program:
```
/home/andreas/src/efl/beispiele/elementary_layout_cxx_example1/elementary_layout_cxx_example1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff50b2700 (LWP 592627)]
[New Thread 0x7ffff48b1700 (LWP 592628)]
[New Thread 0x7ffff40b0700 (LWP 592629)]
[Thread 0x7ffff40b0700 (LWP 592629) exited]
malloc_consolidate(): invalid chunk size
Thread 1 "elementary_layo" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff744c859 in __GI_abort () at abort.c:79
#2 0x00007ffff74b73ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff75e1285 "%s\n")
at ../sysdeps/posix/libc_fatal.c:155
#3 0x00007ffff74bf47c in malloc_printerr (str=str@entry=0x7ffff75e3278 "malloc_consolidate(): invalid chunk size")
at malloc.c:5347
#4 0x00007ffff74bfc58 in malloc_consolidate (av=av@entry=0x7ffff7612b80 <main_arena>) at malloc.c:4477
#5 0x00007ffff74c1e03 in _int_malloc (av=av@entry=0x7ffff7612b80 <main_arena>, bytes=bytes@entry=1088) at malloc.c:3699
#6 0x00007ffff74c5d15 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:3428
#7 0x00007ffff63ffb7a in ?? () from /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0
#8 0x00007ffff6400124 in hb_ft_font_create () from /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0
#9 0x00007ffff6fc15f5 in _evas_common_font_ot_shape () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#10 0x00007ffff6fc17d2 in evas_common_font_ot_populate_text_props () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#11 0x00007ffff6fc0128 in _content_create_ot () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#12 0x00007ffff6fc0560 in evas_common_text_props_content_create () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#13 0x00007ffff6f48dcd in eng_font_text_props_info_create () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#14 0x00007ffff7054b1e in _evas_object_text_item_new () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#15 0x00007ffff70555b0 in _evas_object_text_layout () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#16 0x00007ffff705ba82 in _evas_object_text_recalc () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#17 0x00007ffff70564a7 in _evas_text_efl_text_text_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#18 0x00007ffff724e910 in efl_text_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#19 0x00007ffff6e2a8d8 in _edje_text_fit_x () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#20 0x00007ffff6e2bd90 in _edje_text_recalc_apply () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#21 0x00007ffff6d73502 in _edje_part_recalc_single_text () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#22 0x00007ffff6d77535 in _edje_part_recalc_single () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#23 0x00007ffff6d7ac30 in _edje_part_recalc () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#24 0x00007ffff6d719aa in _edje_recalc_table_parts () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#25 0x00007ffff6d71abb in _edje_recalc_do () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#26 0x00007ffff6e26681 in _efl_canvas_layout_efl_gfx_entity_size_set () from /opt/e/lib/x86_64-linux-gnu/libedje.so.1
#27 0x00007ffff7258f39 in efl_gfx_entity_size_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#28 0x00007ffff7027414 in _efl_canvas_object_efl_gfx_entity_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#29 0x00007ffff72591c2 in efl_gfx_entity_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#30 0x00007ffff70274ce in evas_object_geometry_set () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#31 0x00007ffff7d788ea in _elm_win_resize_job () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#32 0x00007ffff7d7d630 in _efl_ui_win_show () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#33 0x00007ffff7d7da65 in _efl_ui_win_efl_gfx_entity_visible_set () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#34 0x00007ffff7259528 in efl_gfx_entity_visible_set () from /opt/e/lib/x86_64-linux-gnu/libefl.so.1
#35 0x00007ffff70abeb1 in evas_render_pre () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#36 0x00007ffff70ac030 in evas_render_pending_objects_flush () from /opt/e/lib/x86_64-linux-gnu/libevas.so.1
#37 0x00007ffff7d84796 in _win_finalize_job_cb () from /opt/e/lib/x86_64-linux-gnu/libelementary.so.1
#38 0x00007ffff73b9acb in _eina_future_cb_easy () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#39 0x00007ffff73b693f in _eina_future_cb_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#40 0x00007ffff73b6a71 in _eina_future_dispatch_internal () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#41 0x00007ffff73b6b87 in _eina_future_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#42 0x00007ffff73b6d11 in _eina_future_dispatch () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#43 0x00007ffff73b6ded in _scheduled_entry_cb () from /opt/e/lib/x86_64-linux-gnu/libeina.so.1
#44 0x00007ffff7831d17 in _futures_dispatch_cb () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#45 0x00007ffff78329f9 in _event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#46 0x00007ffff7832c0a in _efl_object_event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#47 0x00007ffff7832cc7 in efl_event_callback_call () from /opt/e/lib/x86_64-linux-gnu/libeo.so.1
#48 0x00007ffff786b56a in _ecore_main_loop_iterate_internal () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#49 0x00007ffff7868a07 in _ecore_main_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#50 0x00007ffff7870d13 in _efl_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#51 0x00007ffff78732d6 in efl_loop_begin () from /opt/e/lib/x86_64-linux-gnu/libecore.so.1
#52 0x0000555555556fda in main (argc=1, argv=0x7fffffffd508) at elementary_layout_cxx_example1.cpp:43
```
valgrind output:
```
valgrind ./elementary_layout_cxx_example1
==593080== Memcheck, a memory error detector
==593080== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==593080== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==593080== Command: ./elementary_layout_cxx_example1
==593080==
==593080== Invalid free() / delete / delete[] / realloc()
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Address 0xbcb6210 is 0 bytes inside a block of size 8 free'd
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Block was alloc'd at
==593080== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10BD09: bool eo_cxx::efl::layout::Signal::signal_callback_add<void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)>(efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >, void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)) const (efl_layout_signal.eo.impl.hh:60)
==593080== by 0x10AE0A: efl_main(void*, _Efl_Event const*) (elementary_layout_cxx_example1.cpp:30)
==593080== by 0x4FEAAA1: _event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEAC09: _efl_object_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEACC6: efl_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4F4AA2D: _efl_loop_arguments_send (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4FEC187: _efl_future_cb (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x543893E: _eina_future_cb_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438A70: _eina_future_dispatch_internal (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438B86: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438D10: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080==
ERROR: ecore_animator thread - epoll_wait(..., 200) at 273256.86684 should have slept ~ 0.01667s but took 0.03607s!
q
^C==593080== Invalid free() / delete / delete[] / realloc()
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5AA2E65: _edje_signal_callback_free (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A6D4D2: _edje_del (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A6D91C: _edje_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7DE9F: _efl_canvas_layout_efl_canvas_group_group_del (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5741B99: efl_canvas_group_del (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x57402B7: evas_object_smart_del (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x572813A: _efl_canvas_object_efl_object_invalidate (in /opt/e/lib/x86_64-linux-gnu/libevas.so.1.25.99)
==593080== by 0x4FEE5C9: efl_invalidate (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x5A7D7E3: _efl_canvas_layout_efl_object_invalidate (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== Address 0xbcb6210 is 0 bytes inside a block of size 8 free'd
==593080== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10C025: efl::eolian::function_wrapper<void (*)(void*, _Eo_Opaque*, char const*, char const*), void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >), efl::eolian::EflLayoutSignalCb__function_tag>::deleter(void*) (efl_layout_signal.eo.hh:33)
==593080== by 0x5AA2C75: _edje_signal_callback_matches_unref (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7974C: _edje_emit_cb (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A7939F: _edje_emit_handle (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A71F95: _edje_message_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A72402: _edje_message_queue_process (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x5A70E0A: _edje_job (in /opt/e/lib/x86_64-linux-gnu/libedje.so.1.25.99)
==593080== by 0x4F3FBAD: _ecore_job_event_handler (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F46F2B: _ecore_event_message_handler_efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F54062: efl_loop_message_handler_message_call (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4F4B9CC: _efl_loop_message_process (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== Block was alloc'd at
==593080== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==593080== by 0x10BD09: bool eo_cxx::efl::layout::Signal::signal_callback_add<void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)>(efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >, void (*)(efl::layout::Signal, efl::eina::basic_string_view<char, std::char_traits<char> >, efl::eina::basic_string_view<char, std::char_traits<char> >)) const (efl_layout_signal.eo.impl.hh:60)
==593080== by 0x10AE0A: efl_main(void*, _Efl_Event const*) (elementary_layout_cxx_example1.cpp:30)
==593080== by 0x4FEAAA1: _event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEAC09: _efl_object_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4FEACC6: efl_event_callback_call (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x4F4AA2D: _efl_loop_arguments_send (in /opt/e/lib/x86_64-linux-gnu/libecore.so.1.25.99)
==593080== by 0x4FEC187: _efl_future_cb (in /opt/e/lib/x86_64-linux-gnu/libeo.so.1.25.99)
==593080== by 0x543893E: _eina_future_cb_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438A70: _eina_future_dispatch_internal (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438B86: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080== by 0x5438D10: _eina_future_dispatch (in /opt/e/lib/x86_64-linux-gnu/libeina.so.1.25.99)
==593080==
==593080==
==593080== HEAP SUMMARY:
==593080== in use at exit: 90,558 bytes in 999 blocks
==593080== total heap usage: 129,668 allocs, 103,481 frees, 48,345,424 bytes allocated
==593080==
==593080== LEAK SUMMARY:
==593080== definitely lost: 95 bytes in 1 blocks
==593080== indirectly lost: 0 bytes in 0 blocks
==593080== possibly lost: 0 bytes in 0 blocks
==593080== still reachable: 90,463 bytes in 998 blocks
==593080== suppressed: 0 bytes in 0 blocks
==593080== Rerun with --leak-check=full to see details of leaked memory
==593080==
==593080== For lists of detected and suppressed errors, rerun with: -s
==593080== ERROR SUMMARY: 424 errors from 2 contexts (suppressed: 0 from 0)
```