[X2Go-Commits] [x2gokdrive] 01/01: Reinitiaization of windows after client reconnected.
git-admin at x2go.org
git-admin at x2go.org
Thu Feb 10 16:29:23 CET 2022
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/rootless-mode
in repository x2gokdrive.
commit 71c733e4a008b6a5ff472ebd7381ea7417cb785b
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Thu Feb 10 09:29:09 2022 -0600
Reinitiaization of windows after client reconnected.
---
x2gokdriveremote.c | 64 ++++++++++++++++++++++--------------------------------
x2gokdriveremote.h | 1 +
2 files changed, 27 insertions(+), 38 deletions(-)
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index 58b262b..b92d33b 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -2055,6 +2055,30 @@ void setAgentState(int state)
remoteVars.agentState=state;
}
+void delete_all_windows(void)
+{
+ //sendqueue_mutex should be locked here
+ struct remoteWindow* rwin=remoteVars.windowList;
+ struct remoteWindow* tmp;
+ while(rwin)
+ {
+ //remove window from list and free resources
+ //EPHYR_DBG("release window %p, %s",rwin->ptr, rwin->name);
+ tmp=rwin;
+ rwin=rwin->next;
+ if(tmp->name)
+ {
+ free(tmp->name);
+ }
+ if(tmp->icon_png)
+ {
+ free(tmp->icon_png);
+ }
+ free(tmp);
+ }
+ remoteVars.windowList=NULL;
+}
+
void disconnect_client(void)
{
EPHYR_DBG("DISCONNECTING CLIENT, DOING SOME CLEAN UP");
@@ -2062,6 +2086,7 @@ void disconnect_client(void)
pthread_mutex_lock(&remoteVars.sendqueue_mutex);
remoteVars.client_connected=FALSE;
setAgentState(SUSPENDED);
+ delete_all_windows();
clear_send_queue();
clear_frame_cache(0);
freeCursors();
@@ -4342,44 +4367,6 @@ void remote_check_rootless_windows_for_updates(KdScreenInfo *screen)
rwin->foundInWinTree=FALSE;
rwin=rwin->next;
}
- /*
- // EPHYR_DBG("END TREE CHECK");
- //if client is not connected, release deleted windows here
- if(remoteVars.client_connected==FALSE)
- {
- //sendqueue mutex is locked here
- prev=NULL;
- rwin=remoteVars.windowList;
- while(rwin)
- {
- if(rwin->state==WDEL)
- {
- //remove window from list and free resources
-// EPHYR_DBG("release window %p, %s",rwin->ptr, rwin->name);
- if(rwin==remoteVars.windowList)
- {
- remoteVars.windowList=rwin->next;
- }
- if(prev)
- {
- prev->next=rwin->next;
- }
- tmp=rwin;
- rwin=rwin->next;
- if(tmp->name)
- {
- free(tmp->name);
- }
- free(tmp);
- }
- else
- {
- prev=rwin;
- rwin=rwin->next;
- }
- }
- remoteVars.windowsUpdated=FALSE;
- }*/
pthread_mutex_unlock(&remoteVars.sendqueue_mutex);
}
@@ -4633,6 +4620,7 @@ void rebuild_caches(void)
clear_send_queue();
clear_frame_cache(0);
freeCursors();
+ delete_all_windows();
remoteVars.cache_rebuilt=TRUE;
pthread_cond_signal(&remoteVars.have_sendqueue_cond);
pthread_mutex_unlock(&remoteVars.sendqueue_mutex);
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index eb67378..a6453ab 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -483,6 +483,7 @@ void readInputSelectionHeader(char* buff);
void pollEvents(void);
#endif /* XORG_VERSION_CURRENT */
void clear_frame_cache(uint32_t max_elements);
+void delete_all_windows(void);
uint32_t calculate_crc(uint32_t width, uint32_t height, int32_t dx, int32_t dy);
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
More information about the x2go-commits
mailing list