Compare commits

...

3 Commits

Author SHA1 Message Date
Robin Gareus 354e60d657
Drop session's monitor bus reference when removing the bus 2024-04-25 19:18:06 +02:00
Robin Gareus 848832f8b0
Flush GraphNode RCU when removing Routes
Since 44610c787 RCU keeps references until another write happens.
even before then, some shared_ptr references may have been kept.

When using a process graph, a route's activision-set can
hold references to other graph-nodes (routes). This lead
to Routes not being deleted until a second graph-reorder
flushed the RCU.
2024-04-25 19:18:06 +02:00
Robin Gareus 97becda83a
Update icon rendering tool 2024-04-25 19:18:02 +02:00
5 changed files with 56 additions and 14 deletions

View File

@ -60,6 +60,7 @@ public:
node_set_t const& activation_set (GraphChain const* const g) const;
int init_refcount (GraphChain const* const g) const;
void flush_graph_activision_rcu ();
protected:
friend struct GraphChain;

View File

@ -46,6 +46,12 @@ GraphActivision::init_refcount (GraphChain const* const g) const
return m->at (g);
}
void
GraphActivision::flush_graph_activision_rcu ()
{
_activation_set.flush ();
}
/* ****************************************************************************/
GraphNode::GraphNode (std::shared_ptr<Graph> graph)

View File

@ -1101,6 +1101,7 @@ Session::remove_monitor_section ()
}
remove_route (_monitor_out);
_monitor_out.reset ();
if (deletion_in_progress ()) {
return;
}
@ -1410,6 +1411,8 @@ Session::remove_surround_master ()
}
remove_route (_surround_master);
_surround_master.reset ();
if (deletion_in_progress ()) {
return;
}
@ -3849,12 +3852,10 @@ Session::remove_routes (std::shared_ptr<RouteList> routes_to_remove)
* going away, then flush old references out of the graph.
*/
routes.flush (); // maybe unsafe, see below.
resort_routes ();
/* get rid of it from the dead wood collection in the route list manager */
/* XXX i think this is unsafe as it currently stands, but i am not sure. (pd, october 2nd, 2006) */
routes.flush ();
/* remove these routes from the selection if appropriate, and signal
@ -3882,6 +3883,15 @@ Session::remove_routes (std::shared_ptr<RouteList> routes_to_remove)
return;
}
/* really drop reference to the Surround Master to
* unload the vapor plugin. While the RCU keeps a refecent the
* SurroundMaster, a new SurroundMaster cannot be added.
*/
std::shared_ptr<RouteList const> r = routes.reader ();
for (auto const& rt : *r) {
rt->flush_graph_activision_rcu ();
}
PropertyChange pc;
pc.add (Properties::order);
PresentationInfo::Change (pc);

View File

@ -196,7 +196,10 @@ main (int argc, char** argv)
sq = ceil (sqrt (ArdourIcon::NoIcon + 3));
cairo_surface_t* cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2 * bd + wh * sq, 2 * bd + wh * sq);
int w = sq;
int h = ceil ((ArdourIcon::NoIcon + 3.0) / sq);
cairo_surface_t* cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 2 * bd + wh * w, 2 * bd + wh * h);
cairo_t* cr = cairo_create (cs);
Gtkmm2ext::set_source_rgba (cr, bg_color);
@ -214,7 +217,7 @@ main (int argc, char** argv)
if (bd > 0) {
Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_set_line_width (cr, 1);
cairo_rectangle (cr, bd - .5, bd - .5, 1 + wh * sq, 1 + wh * sq);
cairo_rectangle (cr, bd - .5, bd - .5, 1 + wh * w, 1 + wh * h);
cairo_stroke (cr);
cairo_set_font_size (cr, fs);
for (int rc = 0; rc < sq; ++rc) {
@ -228,6 +231,10 @@ main (int argc, char** argv)
);
cairo_show_text (cr, tmp);
if (rc >= h) {
continue;
}
snprintf (tmp, sizeof(tmp), "%d", rc + 1);
cairo_text_extents (cr, tmp, &extents);
cairo_move_to (cr,

View File

@ -1,15 +1,33 @@
ICONFLAGS?=-g
AD = ../..
CXXFLAGS = -Wall
BL = ../../build/libs
TK = ../../build/libs/tk
CXXFLAGS = -Wall -fsanitize=address
CPPFLAGS = -I $(AD)/libs/gtkmm2ext -I $(AD)/libs/widgets -I $(AD)/libs/pbd -I $(AD)/build/libs/pbd
CPPFLAGS += `pkg-config --cflags cairo cairomm-1.0 libxml-2.0 glibmm-2.4 gtkmm-2.4`
CPPFLAGS += -I $(AD)/libs/tk/ydkmm/ydkmm -I $(AD)/libs/tk/ydk/ydk/
CPPFLAGS += -I $(AD)/libs/tk/ytkmm/ytkmm -I $(AD)/libs/tk/ytk/ytk/
CPPFLAGS += -I $(AD)/libs/tk/ztkmm/ztkmm/ -I $(AD)/libs/tk/ztk/ztk/
CPPFLAGS += -I $(AD)/libs/tk/ydk-pixbuf/ydk-pixbuf/
CPPFLAGS += `pkg-config --cflags cairo pangomm-1.4 cairomm-1.0 libxml-2.0 glibmm-2.4 giomm-2.4`
LDFLAGS = -L$(AD)/build/libs/pbd -Wl,-rpath=$(AD)/build/libs/pbd
LDFLAGS += -L$(AD)/build/libs/gtkmm2ext -Wl,-rpath=$(AD)/build/libs/gtkmm2ext
LDFLAGS += -L$(AD)/build/libs/widgets -Wl,-rpath=$(AD)/build/libs/widgets
LDFLAGS = -L$(BL)/pbd -Wl,-rpath=$(BL)/pbd
LDFLAGS += -L$(BL)/gtkmm2ext -Wl,-rpath=$(BL)/gtkmm2ext
LDFLAGS += -L$(BL)/widgets -Wl,-rpath=$(BL)/widgets
LDLIBS = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4` -lpbd -lgtkmm2ext -lwidgets
LDFLAGS += -L$(TK)/ztk -Wl,-rpath=$(TK)/ztk
LDFLAGS += -L$(TK)/ydk -Wl,-rpath=$(TK)/ydk
LDFLAGS += -L$(TK)/ytk -Wl,-rpath=$(TK)/ytk
LDFLAGS += -L$(TK)/ydk-pixbuf -Wl,-rpath=$(TK)/ydk-pixbuf
LDFLAGS += -L$(TK)/ztkmm -Wl,-rpath=$(TK)/ztkmm
LDFLAGS += -L$(TK)/ydkmm -Wl,-rpath=$(TK)/ydkmm
LDFLAGS += -L$(TK)/ytkmm -Wl,-rpath=$(TK)/ytkmm
LDLIBS = `pkg-config --libs cairo cairomm-1.0 libxml-2.0 glibmm-2.4`
LDLIBS += -lztk -lydk -lytk -lydk-pixbuf -lztkmm -lydkmm -lytkmm
LDLIBS += -lpbd -lgtkmm2ext -lwidgets
icon: icon.cc libwidgets
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ icon.cc $(LDLIBS)
@ -19,10 +37,10 @@ libwidgets:
show: icon
rm -f /tmp/ardour_icons-*.png
./icon $(ICONFLAGS) -s 22 -o /tmp/ardour_icons-22.png
./icon $(ICONFLAGS) -s 23 -o /tmp/ardour_icons-23.png
./icon $(ICONFLAGS) -s 44 -o /tmp/ardour_icons-44.png
./icon $(ICONFLAGS) -s 45 -o /tmp/ardour_icons-45.png
ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 22 -o /tmp/ardour_icons-22.png
ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 23 -o /tmp/ardour_icons-23.png
ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 44 -o /tmp/ardour_icons-44.png
ASAN_OPTIONS=halt_on_error=0 LD_LIBRARY_PATH=$(TK)/ytkmm/:$(TK)/ydkmm:$(TK)/ytk:$(TK)/ydk:$(TK)/ztkmm:$(TK)/ydk-pixbuf:$(TK)/ztk ./icon $(ICONFLAGS) -s 45 -o /tmp/ardour_icons-45.png
convert -gravity center \
/tmp/ardour_icons-*.png \
-background none \