Branch: refs/heads/master
Home: https://github.com/synfig/synfig
Commit: 055e0f940dd8b8e22fac1a89e3c8351076e2f10d
https://github.com/synfig/synfig/commit/055e0f940dd8b8e22fac1a89e3c8351076e2f10d
Author: rodolforg <[email protected]>
Date: 2021-11-15 (Mon, 15 Nov 2021)
Changed paths:
M synfig-studio/src/gui/app.cpp
M synfig-studio/src/gui/dialogs/dialog_workspaces.cpp
M synfig-studio/src/gui/docks/dock_curves.cpp
M synfig-studio/src/gui/docks/dock_curves.h
M synfig-studio/src/gui/docks/dock_soundwave.cpp
M synfig-studio/src/gui/docks/dock_timetrack2.cpp
M synfig-studio/src/gui/docks/dock_timetrack2.h
M synfig-studio/src/gui/states/state_bline.cpp
M synfig-studio/src/gui/widgets/widget_curves.cpp
M synfig-studio/src/gui/widgets/widget_curves.h
M synfig-studio/src/gui/widgets/widget_fontfamily.cpp
M synfig-studio/src/gui/widgets/widget_fontfamily.h
M synfig-studio/src/gui/widgets/widget_timetrack.cpp
M synfig-studio/src/gui/widgets/widget_timetrack.h
M synfig-studio/src/gui/workarea.cpp
Log Message:
-----------
Studio: avoid lambda functions for signal callbacks (#2294)
Specially important for WorkArea queuing rendering.
Reasoning by Kjell Ahlstedt (gtkmm maintainer) follows below:
>From the documentation of sigc::mem_fun():
```
* @note If the object type inherits from sigc::trackable, and the
* functor returned from mem_fun() is assigned to a sigc::slot, the functor
* will be automatically cleared when the object goes out of scope. Invoking
* that slot will then have no effect and will not try to use the destroyed
* instance.
```
In most examples in the gtkmm tutorial the signal handlers are members of
widgets.
All widgets inherit from sigc::trackable. The automatic disconnection when a
widget is destroyed would be lost if a sigc::mem_fun() is replaced by a C++
lambda
expression. Unless it's combined with sigc::track_obj():
```c++
m_button.signal_clicked().connect(sigc::track_obj([this]{ on_button_clicked();
}, *this));
```
but that's no better than sigc::mem_fun(), is it?
This kind of automatic disconnection is not always necessary. Some instances of
mem_fun() could be replaced by lambda expressions, to show that it's possible.
Preferably together with a description of the pros and cons of mem_fun() and
lambda expressions. But I don't recommend replacing the majority of the
mem_fun()s.
https://gitlab.gnome.org/GNOME/gtkmm-documentation/-/issues/10
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl