I got this running tests:
leslie@terabithia:~/git/wine64/dlls/quartz/tests$ make && ~/git/wine/tools/runtest waveparser make[1]: Entering directory '/home/leslie/git/wine64' make[1]: Nothing to be done for 'dlls/quartz/tests/all'. make[1]: Leaving directory '/home/leslie/git/wine64' waveparser.c:154: Test marked todo: Got hr 0x80004002, expected 0. 0118:fixme:ole:CoCreateInstanceEx no instance created for interface {56a86895-0ad4-11ce-b03a-0020af0ba770} of class {d51bd5a1-7548-11cf-a520-0080c77ef58a}, hr 0x80004002.
(wine:329482): GLib-GObject-WARNING **: 15:30:24.992: instance with invalid (NULL) class pointer
(wine:329482): GLib-GObject-CRITICAL **: 15:30:24.992: g_signal_emit_valist: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed quartz\tests\quartz_test.exe: ../wine/dlls/winegstreamer/wg_parser.c:584: wg_parser_push_data: Assertion `ret == GST_FLOW_OK || ret == GST_FLOW_FLUSHING' failed.
It can be reproduced every time if you add a g_usleep(100000) right before the gst_buffer_new_and_alloc() call.
The problem is that you're (implicitly) destroying the appsrc in wg_parser_disconnect(), but the read thread isn't shut down until later.
There are a few ways to solve this. We have to keep the disconnect -> shutdown read thread -> destroy order as-is (because the read thread needs to be unblocked if it's blocked in wg_parser_get_next_read_offset, and we can't destroy the parser while anything still has a pointer to it), but given that, I think the right solution here is probably to return from wg_parser_push_data() if !parser->sink_connected.