Re: [E-devel] Crash using C++ Layout signal API

Felipe Magno de Almeida <[email protected]>
Newsgroups gmane.comp.window-managers.enlightenment.devel
Message-ID <CADfx-VS96f6gCCEaUg+QTeUjq3i_anA+HjETKRKYO=+S-xCBaw@mail.gmail.com>
Hello Andreas,

On Fri, Jun 25, 2021 at 7:15 PM Andreas Volz <[email protected]> wrote:
>
>
>
> Am 24.06.21 um 21:25 schrieb Felipe Magno de Almeida:
> > Hello Andreas
> >
> > On Thu, Jun 24, 2021 at 4:22 PM Andreas Volz <[email protected]> wrote:
> >>
> >> I just add another question now as it's working without crash. :-)
> >>
> >> With signal_callback_add() I could only add a C function or static C++
> >> member function. But practically I design my callback functions to
> >> hand-over them the this-pointer that they could access members.
> >>
> >> But here is no possibility to add a data pointer to
> >> signal_callback_add() that is hand-over to the callback. Any ideas to
> >> attach the this pointer to the Eo object and then get it back from the
> >> efl::layout::Signal from inside the callback?
> >>
> >> BTW: I would love if the C++ interface would use libsigc++ as signaling
> >> system. It's so a well designed signaling system, documented and easy to
> >> use.
> >
> > You can use any function object, not just pointers. You can use a
> > lambda for example:
> >
> > ```
> > std::shared_ptr<MyClass> my_object;
> > layout.signal_callback_add("edje", "func", [=] (auto&& signal, auto&&
> > emission, auto&& source) { my_object->do_something(signal, emission,
> > source); });
> > ```
>
>
> This is a very good idea! Works great.
>
> Just a question about the signal prototype. I used this one and it
> works. I tried to use type std::string as emission/source but this
> result in another crash. Any ideas why conversation from
> efl::eina::basic_string_view<char>  to std::string has problems?
>
> void allFunc2(efl::layout::Signal s, efl::eina::basic_string_view<char>
> emission, efl::eina::basic_string_view<char>  source)

I have to investigate. That should not happen.

-- 
Felipe Magno de Almeida
Owner @ Expertise Solutions
www: https://expertise.dev
phone: +55 48 9 9681.0157
LinkedIn: in/felipealmeida
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.