Copilot commented on code in PR #50401:
URL: https://github.com/apache/arrow/pull/50401#discussion_r3532887021


##########
c_glib/arrow-flight-glib/server.cpp:
##########
@@ -1236,6 +1251,12 @@ gaflight_server_listen(GAFlightServer *server,
 {
   auto flight_server = gaflight_servable_get_raw(GAFLIGHT_SERVABLE(server));
   const auto flight_options = gaflight_server_options_get_raw(options);
+  auto priv = GAFLIGHT_SERVER_GET_PRIVATE(server);
+  if (priv->options) {
+    g_object_unref(priv->options);
+  }
+  priv->options = options;
+  g_object_ref(priv->options);

Review Comment:
   `gaflight_server_listen()` unrefs the currently stored `priv->options` 
before taking a ref on the incoming `options`, and it doesn’t guard against the 
self-assignment case. Following the pattern used elsewhere in this file (e.g. 
server-options auth-handler setter), it’s safer to no-op when `priv->options == 
options` and to `g_object_ref(options)` before potentially dropping the old 
reference.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to