[fix] fix crash when transmission id does not exist

This commit is contained in:
dijunkun
2025-08-19 16:33:29 +08:00
parent c7166975b3
commit 6f8fd6a030
5 changed files with 13 additions and 46 deletions

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- 应用的Bundle identifier通常使用反向域名标记 -->
<key>CFBundleIdentifier</key>
<string>com.yourcompany.yourappname</string>
<!-- 应用的显示名称 -->
<key>CFBundleName</key>
<string>Your App Name</string>
<!-- 应用的版本号 -->
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<!-- 应用的构建版本号 -->
<key>CFBundleVersion</key>
<string>1</string>
<!-- 请求麦克风访问权限 -->
<key>NSMicrophoneUsageDescription</key>
<string>App requires access to the microphone for audio recording.</string>
<!-- 请求相机访问权限 -->
<key>NSCameraUsageDescription</key>
<string>App requires access to the camera for video recording.</string>
<!-- 请求使用连续相机设备 -->
<key>NSCameraUseContinuityCameraDeviceType</key>
<string>Your usage description here</string>
<!-- High DPI -->>
<key>NSHighResolutionCapable</key>
<true/>
<!-- 其他权限和配置可以在这里添加 -->
</dict>
</plist>

View File

@@ -3,7 +3,7 @@
#include "rd_log.h" #include "rd_log.h"
#include "render.h" #include "render.h"
int Render::ConnectionStatusWindow( bool Render::ConnectionStatusWindow(
std::shared_ptr<SubStreamWindowProperties> &props) { std::shared_ptr<SubStreamWindowProperties> &props) {
if (show_connection_status_window_) { if (show_connection_status_window_) {
const ImGuiViewport *viewport = ImGui::GetMainViewport(); const ImGuiViewport *viewport = ImGui::GetMainViewport();
@@ -160,7 +160,7 @@ int Render::ConnectionStatusWindow(
show_connection_status_window_ = false; show_connection_status_window_ = false;
re_enter_remote_id_ = true; re_enter_remote_id_ = true;
DestroyPeer(&props->peer_); DestroyPeer(&props->peer_);
client_properties_.erase(props->remote_id_); return true;
} }
} }
@@ -175,5 +175,5 @@ int Render::ConnectionStatusWindow(
ImGui::End(); ImGui::End();
ImGui::PopStyleVar(); ImGui::PopStyleVar();
} }
return 0; return false;
} }

View File

@@ -29,8 +29,13 @@ int Render::MainWindow() {
RecentConnectionsWindow(); RecentConnectionsWindow();
StatusBar(); StatusBar();
for (auto& it : client_properties_) { for (auto it = client_properties_.begin(); it != client_properties_.end();) {
ConnectionStatusWindow(it.second); auto& props = it->second;
if (ConnectionStatusWindow(props)) {
it = client_properties_.erase(it);
} else {
++it;
}
} }
return 0; return 0;

View File

@@ -151,7 +151,8 @@ class Render {
int ControlBar(std::shared_ptr<SubStreamWindowProperties> &props); int ControlBar(std::shared_ptr<SubStreamWindowProperties> &props);
int AboutWindow(); int AboutWindow();
int StatusBar(); int StatusBar();
int ConnectionStatusWindow(std::shared_ptr<SubStreamWindowProperties> &props); bool ConnectionStatusWindow(
std::shared_ptr<SubStreamWindowProperties> &props);
int ShowRecentConnections(); int ShowRecentConnections();
private: private: