void rfbScreenCleanup(rfbScreenInfoPtr rfbScreen) { rfbClientIteratorPtr i=rfbGetClientIterator(rfbScreen); rfbClientPtr cl,cl1=rfbClientIteratorNext(i); while(cl1) { cl=rfbClientIteratorNext(i); rfbClientConnectionGone(cl1); cl1=cl; } rfbReleaseClientIterator(i); rfbAuthCleanupScreen(rfbScreen); /* TODO: hang up on all clients and free all reserved memory */ #define FREE_IF(x) if(rfbScreen->x) free(rfbScreen->x) FREE_IF(colourMap.data.bytes); FREE_IF(underCursorBuffer); if(rfbScreen->cursor) rfbFreeCursor(rfbScreen->cursor); if(rfbScreen->desktopName) free(rfbScreen->desktopName); free(rfbScreen); #ifdef VINO_HAVE_JPEG rfbTightCleanup(); #endif }
~VNCServerImpl() { if (mFrameBuffer) RTMemFree(mFrameBuffer); if (mCursor) rfbFreeCursor(mCursor); memset(szVNCPassword, '\0', sizeof(szVNCPassword)); }
~VNCServerImpl() { if (mFrameBuffer) RTMemFree(mFrameBuffer); if (mCursor) rfbFreeCursor(mCursor); RT_ZERO(szVNCPassword); if (mVNCServer) rfbScreenCleanup(mVNCServer); }
void rfbScreenCleanup(rfbScreenInfoPtr screen) { rfbClientIteratorPtr i=rfbGetClientIterator(screen); rfbClientPtr cl,cl1=rfbClientIteratorNext(i); while(cl1) { cl=rfbClientIteratorNext(i); rfbClientConnectionGone(cl1); cl1=cl; } rfbReleaseClientIterator(i); #define FREE_IF(x) if(screen->x) free(screen->x) FREE_IF(colourMap.data.bytes); FREE_IF(underCursorBuffer); TINI_MUTEX(screen->cursorMutex); if(screen->cursor && screen->cursor->cleanup) rfbFreeCursor(screen->cursor); rfbRRECleanup(screen); rfbCoRRECleanup(screen); rfbUltraCleanup(screen); #ifdef LIBVNCSERVER_HAVE_LIBZ rfbZlibCleanup(screen); #ifdef LIBVNCSERVER_HAVE_LIBJPEG rfbTightCleanup(screen); #endif /* free all 'scaled' versions of this screen */ while (screen->scaledScreenNext!=NULL) { rfbScreenInfoPtr ptr; ptr = screen->scaledScreenNext; screen->scaledScreenNext = ptr->scaledScreenNext; free(ptr->frameBuffer); free(ptr); } #endif free(screen); }