From 587b68ed17aa5dd46dc4583d3ee90d6ec3ba5894 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 15:43:55 -0400 Subject: [PATCH 1/4] yuzu/CMakeLists: Disable implicit type narrowing in connect() calls Prevents hard-to-diagnose bugs from potentially occurring and requires any type narrowing to be explicitly performed by our code. --- src/citra_qt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 502531fca..8b543c731 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -228,6 +228,9 @@ target_compile_definitions(citra-qt PRIVATE # Use QStringBuilder for string concatenation to reduce # the overall number of temporary strings created. -DQT_USE_QSTRINGBUILDER + + # Disable implicit type narrowing in signal/slot connect() calls. + -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT ) if (CITRA_ENABLE_COMPATIBILITY_REPORTING) From 3d2e6165d33c18ef8caba8046eab2123ae73e298 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 15:47:42 -0400 Subject: [PATCH 2/4] yuzu/CMakeLists: Disable unsafe overloads of QProcess' start() function Other overloads of start() are considerably much safer to use if we ever need this in the future and need to pass arguments to the program, given it contains separate parameters for the program path and the arguments themselves, whereas this unsafe overload contains both as a single string. Given the alternatives are much safer, we can disable this. --- src/citra_qt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 8b543c731..fb2e8742f 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -231,6 +231,9 @@ target_compile_definitions(citra-qt PRIVATE # Disable implicit type narrowing in signal/slot connect() calls. -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT + + # Disable unsafe overloads of QProcess' start() function. + -DQT_NO_PROCESS_COMBINED_ARGUMENT_START ) if (CITRA_ENABLE_COMPATIBILITY_REPORTING) From e88a9ace8d28cc773822b63903637670bf23be2f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 5 Jun 2019 16:05:34 -0400 Subject: [PATCH 3/4] yuzu/CMakeLists: Disable implicit QString->QUrl conversions Enforces the use of the proper URL resolution functions. e.g. url = some_local_path_string; should actually be: url = QUrl::fromLocalPath(some_local_path_string); etc. This makes it harder to cause bugs when operating with both strings and URLs at the same time. --- src/citra_qt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index fb2e8742f..edd2a3eb2 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -234,6 +234,9 @@ target_compile_definitions(citra-qt PRIVATE # Disable unsafe overloads of QProcess' start() function. -DQT_NO_PROCESS_COMBINED_ARGUMENT_START + + # Disable implicit QString->QUrl conversions to enforce use of proper resolving functions. + -DQT_NO_URL_CAST_FROM_STRING ) if (CITRA_ENABLE_COMPATIBILITY_REPORTING) From b3e819582e1681f61f7932bcf0218e8bbf6085a8 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Thu, 4 Jul 2019 15:47:04 +0200 Subject: [PATCH 4/4] Fix compilation problems --- src/citra_qt/configuration/configure_graphics.cpp | 5 ++--- src/citra_qt/multiplayer/chat_room.cpp | 2 +- src/citra_qt/multiplayer/lobby.cpp | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/citra_qt/configuration/configure_graphics.cpp b/src/citra_qt/configuration/configure_graphics.cpp index 2b895ecc0..f509377e6 100644 --- a/src/citra_qt/configuration/configure_graphics.cpp +++ b/src/citra_qt/configuration/configure_graphics.cpp @@ -21,11 +21,10 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) ui->layoutBox->setEnabled(!Settings::values.custom_layout); ui->hw_renderer_group->setEnabled(ui->toggle_hw_renderer->isChecked()); - connect(ui->toggle_hw_renderer, &QCheckBox::stateChanged, ui->hw_renderer_group, + connect(ui->toggle_hw_renderer, &QCheckBox::toggled, ui->hw_renderer_group, &QWidget::setEnabled); ui->hw_shader_group->setEnabled(ui->toggle_hw_shader->isChecked()); - connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, ui->hw_shader_group, - &QWidget::setEnabled); + connect(ui->toggle_hw_shader, &QCheckBox::toggled, ui->hw_shader_group, &QWidget::setEnabled); #ifdef __APPLE__ connect(ui->toggle_hw_shader, &QCheckBox::stateChanged, this, [this](int state) { if (state == Qt::Checked) { diff --git a/src/citra_qt/multiplayer/chat_room.cpp b/src/citra_qt/multiplayer/chat_room.cpp index e16b86217..1699ed8ef 100644 --- a/src/citra_qt/multiplayer/chat_room.cpp +++ b/src/citra_qt/multiplayer/chat_room.cpp @@ -425,7 +425,7 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) { QAction* view_profile_action = context_menu.addAction(tr("View Profile")); connect(view_profile_action, &QAction::triggered, [username] { QDesktopServices::openUrl( - QString("https://community.citra-emu.org/u/%1").arg(username)); + QUrl(QString("https://community.citra-emu.org/u/%1").arg(username))); }); } diff --git a/src/citra_qt/multiplayer/lobby.cpp b/src/citra_qt/multiplayer/lobby.cpp index c06738565..cd38c5a22 100644 --- a/src/citra_qt/multiplayer/lobby.cpp +++ b/src/citra_qt/multiplayer/lobby.cpp @@ -64,9 +64,8 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list, // UI Buttons connect(ui->refresh_list, &QPushButton::pressed, this, &Lobby::RefreshLobby); - connect(ui->games_owned, &QCheckBox::stateChanged, proxy, - &LobbyFilterProxyModel::SetFilterOwned); - connect(ui->hide_full, &QCheckBox::stateChanged, proxy, &LobbyFilterProxyModel::SetFilterFull); + connect(ui->games_owned, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterOwned); + connect(ui->hide_full, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterFull); connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch); connect(ui->room_list, &QTreeView::doubleClicked, this, &Lobby::OnJoinRoom); connect(ui->room_list, &QTreeView::clicked, this, &Lobby::OnExpandRoom);