Re: [sigc] C++11 'auto' with sigc::mem_fun doesn't track object lifetime (potential crash)



Hi Kjell,

On 03/02/2016 07:43 PM, Kjell Ahlstedt wrote:
Den 2016-03-02 kl. 16:42, skrev Kjell Ahlstedt:
Den 2016-03-02 kl. 14:22, skrev Andrejs Hanins:
Hi Paul,

On 03/02/2016 03:10 PM, Paul Davis wrote:
if you want the behaviour of sigc::trackable, then you MUST use sigc::slot.  there's no "shoot in the foot" issue here.
That makes sense, but isn't documentation still confusing, as it mentions 'slot' when speaking about mem_fun. Slot is indeed present in the example code below mem_fun description, but it is not obvious which 'slot' the sentence is talking about. I'm not insisting on this, just a space for a potential improvement. Maybe change the docs to "Note that _in the example below_ only if the object..."

The documentation became confusing when we started using C++11, where you can choose between declaring a variable auto or sigc::slot<>. I'll try to make it clearer.

https://git.gnome.org/browse/libsigc++2/commit/?id=1d5c9084f2851c1485ecdb7aa99519bf49e1d57a

Thanks, such clarification would save me a day of deep debugging :)

Otherwise, slots with C++11 works just great for me. My code has many C++11 lambdas which capture slots by value bind to other slots and to member functions of trackable instances and all this machinery works without a hitch, so thanks again for the great library which is C++11 compatible!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]