From f655ac31f7f1a3e75c53a29cf6c8d01ef8973350 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 11 Nov 2015 10:12:43 +0100 Subject: [PATCH] vbox: don't fault if NIC is unavailable This patch prevents vbox from faulting in the (unexpected) case where the VM has a network adaptor configured but the NIC session cannot be opened. --- repos/ports/src/virtualbox/network.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/repos/ports/src/virtualbox/network.cpp b/repos/ports/src/virtualbox/network.cpp index dfc980f59..88e81c34f 100644 --- a/repos/ports/src/virtualbox/network.cpp +++ b/repos/ports/src/virtualbox/network.cpp @@ -452,11 +452,17 @@ static DECLCALLBACK(void) drvNicDestruct(PPDMDRVINS pDrvIns) PDRVNIC pThis = PDMINS_2_DATA(pDrvIns, PDRVNIC); Nic_client *nic_client = pThis->nic_client; - Genode::Signal_transmitter(nic_client->dispatcher()).submit(); + if (!nic_client) + PERR("nic_client not valid at destruction time"); + + if (nic_client) + Genode::Signal_transmitter(nic_client->dispatcher()).submit(); /* wait until the recv thread exits */ destruct_lock()->lock(); - destroy(Genode::env()->heap(), nic_client); + + if (nic_client) + destroy(Genode::env()->heap(), nic_client); }