summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-10-27 13:52:09 +0300
committerMarius Vlad <marius.vlad@collabora.com>2023-10-27 13:56:45 +0300
commit994d8a30b27f05516f6dc0a9f949315241cb9cc0 (patch)
treedd1b52dc66bb8e293abaee835952f4f33c4a062f
parentd8e72099ecbcadc6e8b242686cf012763a5f1a3a (diff)
grpc-proxy: Don't attempt to connect if there's no compositor running
Commit d8e72099ecbcad, 'grpc-proxy: Terminate thread when we're exiting', addressed a rather bigger issue to handle correctly the shutdown/restart sequence. A consequence of that is the initial issue opened in SPEC-4935 with a trace showing a protocol issue, due to fact we're supplying an invalid wl_display without being connected to the compositor. While commit d8e72099ecbcad, 'grpc-proxy: Terminate thread when we're exiting' does fix the issue and would make the underlying bug disappear let's be more pedantic and don't attempt assume we have a compositor connection when in fact we do not. Bug-AGL: SPEC-4935 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Id10dabe5178f52fa6a0cf6d70c70799c98f4b6d5
-rw-r--r--grpc-proxy/main-grpc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/grpc-proxy/main-grpc.cpp b/grpc-proxy/main-grpc.cpp
index 5b07d64..a8c1c5e 100644
--- a/grpc-proxy/main-grpc.cpp
+++ b/grpc-proxy/main-grpc.cpp
@@ -386,6 +386,9 @@ __register_shell_init(void)
struct shell_data_init *sh = new struct shell_data_init;
wl_display = wl_display_connect(NULL);
+ if (!wl_display) {
+ goto err;
+ }
registry = wl_display_get_registry(wl_display);
sh->wait_for_bound = true;
sh->bound_fail = false;
@@ -480,6 +483,10 @@ start_agl_shell_client(void)
struct shell_data *sh = new struct shell_data;
+ if (!wl_display) {
+ goto err;
+ }
+
sh->wl_display = wl_display;
sh->wait_for_doas = true;
sh->wait_for_bound = true;