Fix assertion failure on clicking on bundles whose channels are all of the wrong...
authorCarl Hetherington <carl@carlh.net>
Tue, 27 Sep 2011 20:15:49 +0000 (20:15 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 27 Sep 2011 20:15:49 +0000 (20:15 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@10147 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_matrix.cc
gtk2_ardour/port_matrix_grid.cc

index ae2b19075bdbd1198c251a190ff8582bf7ee52ef..d7e2cfd7fadcd4f83ba03180fef2e0a8f2188c2c 100644 (file)
@@ -379,11 +379,21 @@ PortMatrix::visible_rows () const
        return visible_ports (_row_index);
 }
 
+/** @param column Column; its bundle may be 0 if we are over a row heading.
+ *  @param row Row; its bundle may be 0 if we are over a column heading.
+ */
 void
 PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
 {
        using namespace Menu_Helpers;
 
+       if ((row.bundle && row.bundle->nchannels().n_total() == 0) || (column.bundle && column.bundle->nchannels().n_total() == 0)) {
+               /* One of the bundles has no channels, which means that it has none of the appropriate type,
+                  and is only being displayed to look pretty.  So we don't need to do anything.
+               */
+               return;
+       }
+       
        delete _menu;
 
        _menu = new Menu;
index fa394de8ef6860142a0b725599e474ad6b4f8429..67fa73c0977b3e310e6d4f7b095c37e2e353275a 100644 (file)
@@ -328,6 +328,13 @@ PortMatrixGrid::button_press (double x, double y, int b, uint32_t t, guint)
 void
 PortMatrixGrid::set_association (PortMatrixNode node, bool s)
 {
+       if (node.row.bundle->nchannels().n_total() == 0 || node.column.bundle->nchannels().n_total() == 0) {
+               /* One of the bundles has no channels, which means that it has none of the appropriate type,
+                  and is only being displayed to look pretty.  So we don't need to do anything.
+               */
+               return;
+       }
+       
        if (_matrix->show_only_bundles()) {
 
                for (uint32_t i = 0; i < node.column.bundle->nchannels().n_total(); ++i) {