Changeset View
Changeset View
Standalone View
Standalone View
vnc/vncview.cpp
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Line(s) | 156 | { | |||
---|---|---|---|---|---|
157 | RemoteView::updateConfiguration(); | 157 | RemoteView::updateConfiguration(); | ||
158 | 158 | | |||
159 | // Update the scaling mode in case KeepAspectRatio changed | 159 | // Update the scaling mode in case KeepAspectRatio changed | ||
160 | scaleResize(parentWidget()->width(), parentWidget()->height()); | 160 | scaleResize(parentWidget()->width(), parentWidget()->height()); | ||
161 | } | 161 | } | ||
162 | 162 | | |||
163 | void VncView::startQuitting() | 163 | void VncView::startQuitting() | ||
164 | { | 164 | { | ||
165 | // Already quitted. No need to clean up again and also avoid triggering | ||||
166 | // `disconnected` signal below. | ||||
167 | if (m_quitFlag) | ||||
168 | return; | ||||
169 | | ||||
165 | qCDebug(KRDC) << "about to quit"; | 170 | qCDebug(KRDC) << "about to quit"; | ||
166 | 171 | | |||
167 | setStatus(Disconnecting); | 172 | setStatus(Disconnecting); | ||
168 | 173 | | |||
169 | m_quitFlag = true; | 174 | m_quitFlag = true; | ||
170 | 175 | | |||
171 | vncThread.stop(); | 176 | vncThread.stop(); | ||
172 | 177 | | |||
Show All 19 Lines | 193 | if (!quitSuccess) { | |||
192 | if (!loop.processEvents()) { | 197 | if (!loop.processEvents()) { | ||
193 | qCDebug(KRDC) << "BUG: deadlocked, but no events to deliver?"; | 198 | qCDebug(KRDC) << "BUG: deadlocked, but no events to deliver?"; | ||
194 | } | 199 | } | ||
195 | vncThread.wait(500); | 200 | vncThread.wait(500); | ||
196 | } | 201 | } | ||
197 | 202 | | |||
198 | qCDebug(KRDC) << "Quit VNC thread success:" << quitSuccess; | 203 | qCDebug(KRDC) << "Quit VNC thread success:" << quitSuccess; | ||
199 | 204 | | |||
205 | // emit the disconnect siginal only after all the events are handled. | ||||
206 | // Otherwise some error messages might be thrown away without | ||||
207 | // showing to the user. | ||||
208 | emit disconnected(); | ||||
uwolfer: this signal was never emitted before in this class, right? are you sure you need to emit this… | |||||
Yes, this must be emitted manually and all other backends (rdp and the unfunctional nx) does this. This never done in this class is exactly the cause for the bug I mentioned in the description. yuyichao: Yes, this must be emitted manually and all other backends (rdp and the unfunctional nx) does… | |||||
200 | setStatus(Disconnected); | 209 | setStatus(Disconnected); | ||
201 | } | 210 | } | ||
202 | 211 | | |||
203 | bool VncView::isQuitting() | 212 | bool VncView::isQuitting() | ||
204 | { | 213 | { | ||
205 | return m_quitFlag; | 214 | return m_quitFlag; | ||
206 | } | 215 | } | ||
207 | 216 | | |||
208 | bool VncView::start() | 217 | bool VncView::start() | ||
209 | { | 218 | { | ||
219 | // This flag is used to make sure `startQuitting` only run once. | ||||
220 | // This should no matter but it is an easy way to make sure | ||||
221 | // things works in case the object may get reused. | ||||
222 | m_quitFlag = false; | ||||
is this required? m_quitFlag is initialized with false at the top (m_quitFlag(false),). uwolfer: is this required? m_quitFlag is initialized with false at the top (m_quitFlag(false),). | |||||
yuyichao: See the comment I added for this. I can also make this an assert. | |||||
223 | | ||||
210 | QString vncHost = m_host; | 224 | QString vncHost = m_host; | ||
211 | int vncPort = m_port; | 225 | int vncPort = m_port; | ||
212 | #ifdef LIBSSH_FOUND | 226 | #ifdef LIBSSH_FOUND | ||
213 | if (m_hostPreferences->useSshTunnel()) { | 227 | if (m_hostPreferences->useSshTunnel()) { | ||
214 | Q_ASSERT(!m_sshTunnelThread); | 228 | Q_ASSERT(!m_sshTunnelThread); | ||
215 | 229 | | |||
216 | const int tunnelPort = 58219; // Just a random port | 230 | const int tunnelPort = 58219; // Just a random port | ||
217 | 231 | | |||
▲ Show 20 Lines • Show All 472 Lines • Show Last 20 Lines |
this signal was never emitted before in this class, right? are you sure you need to emit this manually?