| 315 | } |
| 316 | |
| 317 | int CBackendFreeRDP::OnClean() |
| 318 | { |
| 319 | qDebug(log) << Q_FUNC_INFO; |
| 320 | int nRet = 0; |
| 321 | if(m_writeEvent) |
| 322 | { |
| 323 | CloseHandle(m_writeEvent); |
| 324 | m_writeEvent = nullptr; |
| 325 | } |
| 326 | if(m_pContext) |
| 327 | { |
| 328 | rdpContext* pRdpContext = (rdpContext*)m_pContext; |
| 329 | if(!freerdp_disconnect(pRdpContext->instance)) |
| 330 | qCritical(log) << "freerdp_disconnect fail"; |
| 331 | |
| 332 | if(freerdp_client_stop(pRdpContext)) |
| 333 | qCritical(log) << "freerdp_client_stop fail"; |
| 334 | |
| 335 | freerdp_client_context_free(pRdpContext); |
| 336 | m_pContext = nullptr; |
| 337 | } |
| 338 | |
| 339 | #if FREERDP_VERSION_MAJOR >= 3 |
| 340 | if(m_pConnectLayer) { |
| 341 | m_pConnectLayer->Clean(); |
| 342 | m_pConnectLayer->deleteLater(); |
| 343 | m_pConnectLayer = nullptr; |
| 344 | } |
| 345 | #endif |
| 346 | |
| 347 | #ifdef HAVE_LIBSSH |
| 348 | CleanSSHTunnelPipe(); |
| 349 | #endif |
| 350 | |
| 351 | return nRet; |
| 352 | } |
| 353 | |
| 354 | /*! |
| 355 | * \~chinese 插件连接的具体操作处理。因为此插件是非Qt事件,所以在此函数中等待。 |