With the current master changing ports on an alsa card makes PulseAudio crash:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff60d319a in __GI_abort () at abort.c:89
#2 0x00007ffff79008a5 in pa_sink_suspend (s=s@entry=0x55555583be10, suspend=suspend@entry=false, cause=<optimized out>)
#3 0x00007fffecb4ac01 in sink_set_port_cb (s=0x55555583be10, p=0x5555557b0090) at modules/alsa/alsa-sink.c:1533
#4 0x00007ffff7906e82 in pa_sink_process_msg (o=o@entry=0x55555583be10, code=code@entry=22, userdata=userdata@entry=0x7fffffffd5f0,
offset=offset@entry=0, chunk=chunk@entry=0x0) at pulsecore/sink.c:2921
#5 0x00007fffecb4c9cb in sink_process_msg (o=0x55555583be10, code=22, data=0x7fffffffd5f0, offset=0, chunk=0x0)
#6 0x00007ffff78e7155 in asyncmsgq_read_work (i=0x5555557b5250) at pulsecore/rtpoll.c:566
#7 0x00007ffff78e7a75 in pa_rtpoll_run (p=0x5555559908b0) at pulsecore/rtpoll.c:236
#8 0x00007fffecb4d665 in thread_func (userdata=0x555555990660) at modules/alsa/alsa-sink.c:1822
#9 0x00007ffff76833a8 in internal_thread_func (userdata=0x55555584e3a0) at pulsecore/thread-posix.c:81
#10 0x00007ffff6b67519 in start_thread (arg=0x7fffecb23700) at pthread_create.c:456
#11 0x00007ffff618aa4f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
The pa_sink_suspend() call was recently added to sink_set_port_cb(). sink_set_port_cb() is called from the IO thread when deferred volume is enabled, as it usually is.
Fixing this doesn't seem trivial. I think I'll try to make things so that sink_set_port_cb() is only called from the main thread so that it can safely call pa_sink_suspend(). The mixer handling will still need to happen in the IO thread when deferred volume is enabled, but sink_set_port_cb() can probably do that by sending a message to the IO thread.
Fixed in master.