Skip to content

Commit

Permalink
gv_device: fix finalization of gv device
Browse files Browse the repository at this point in the history
Without the fix after a DeviceReset and camera
recreation a segmentation fault happened because
of a null pointer.
  • Loading branch information
feuerste committed Apr 9, 2024
1 parent cb9cefa commit 98825a3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/arvgvdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,15 +2109,17 @@ arv_gv_device_finalize (GObject *object)
arv_gv_device_leave_control (gv_device, NULL);

io_data = priv->io_data;
g_clear_object (&io_data->device_address);
g_clear_object (&io_data->interface_address);
g_clear_object (&io_data->socket);
g_clear_pointer (&io_data->buffer, g_free);
g_mutex_clear (&io_data->mutex);
if (io_data != NULL) {
g_clear_object (&io_data->device_address);
g_clear_object (&io_data->interface_address);
g_clear_object (&io_data->socket);
g_clear_pointer (&io_data->buffer, g_free);
g_mutex_clear (&io_data->mutex);

arv_gpollfd_finish_all (&io_data->poll_in_event, 1);
arv_gpollfd_finish_all (&io_data->poll_in_event, 1);

g_clear_pointer (&priv->io_data, g_free);
g_clear_pointer (&io_data, g_free);
}

g_clear_object (&priv->genicam);
g_clear_pointer (&priv->genicam_xml, g_free);
Expand Down

0 comments on commit 98825a3

Please sign in to comment.