diff --git a/tools/chatgui/src/stream_publish_window.cpp b/tools/chatgui/src/stream_publish_window.cpp index 34d1758b..573e9e8c 100644 --- a/tools/chatgui/src/stream_publish_window.cpp +++ b/tools/chatgui/src/stream_publish_window.cpp @@ -132,7 +132,8 @@ StreamPublishWindow::StreamPublishWindow(StreamPublishEngine* engine, uint64_t g connect(question, &QMessageBox::finished, engine, [engine, generation](int result) { engine->answerSoftwareEncoding(generation, result == QMessageBox::Yes); }); - connect(question, &QObject::destroyed, engine, [engine, generation] { engine->answerSoftwareEncoding(generation, false); }); + connect(question, &QObject::destroyed, engine, + [engine, generation] { engine->answerSoftwareEncoding(generation, false); }, Qt::QueuedConnection); connect(engine, &StreamPublishEngine::stateChanged, question, [engine, generation, question] { if (engine->softwareEncodingRequest() != generation) question->reject(); }); diff --git a/tools/chatgui/tests/test_stream_publish.cpp b/tools/chatgui/tests/test_stream_publish.cpp index c215f115..3959ef37 100644 --- a/tools/chatgui/tests/test_stream_publish.cpp +++ b/tools/chatgui/tests/test_stream_publish.cpp @@ -147,7 +147,10 @@ private slots: debug_config_init(); debug_set_level(DEBUG_LEVEL_WARN); debug_set_category_level(DEBUG_CATEGORY_STREAM, DEBUG_LEVEL_DEBUG); debug_set_category_level(DEBUG_CATEGORY_SYS, DEBUG_LEVEL_ERROR); debug_set_category_level(DEBUG_CATEGORY_VIDEO, DEBUG_LEVEL_DEBUG); - if (qEnvironmentVariableIsSet("UTUN_TEST_SCREEN_CAPTURE")) QLoggingCategory::setFilterRules("qt.multimedia.*=true"); + if (qEnvironmentVariableIsSet("UTUN_TEST_SCREEN_CAPTURE")) { + qunsetenv("WAYLAND_DISPLAY"); qputenv("XDG_SESSION_TYPE", "x11"); + QLoggingCategory::setFilterRules("qt.multimedia.*=true"); + } allocations = u_get_allocated_count(); ua = uasync_create(); QVERIFY(ua); inst = utun_instance_create_from_str(ua, "[global]\nauto_sockets=no\n[chatserver]\ngroup_autoconnect=0\nstorage_autoload=0\nmember_files_enabled=0\n"); @@ -532,6 +535,12 @@ private slots: QCOMPARE(softwareOpens.load(), before); engine.stop(); engine.answerSoftwareEncoding(generation, true); QCOMPARE(softwareOpens.load(), before); QTRY_VERIFY_WITH_TIMEOUT(!engine.active(), 4000); + // Уничтожение окна с открытым вопросом отменяет запуск после удаления его дочерних виджетов. + disconnect(&engine, &StreamPublishEngine::softwareEncodingRequested, &controls, nullptr); + auto* temporary = new StreamPublishWindow(&engine, group); + QVERIFY(engine.start(group, config)); QTRY_COMPARE(requests.size(), 3); + QVERIFY(temporary->findChild("streamCpuConfirmation")); delete temporary; + QTRY_VERIFY_WITH_TIMEOUT(!engine.active(), 4000); QCOMPARE(softwareOpens.load(), before); #else QSKIP("Capture and encoder instrumentation unavailable"); #endif