Unref pending events when disposing the streamsplitter. Also refactor a little to replace a for with a g_list_foreach