mirror of
https://gitlab.freedesktop.org/libfprint/fprintd.git
synced 2026-05-05 23:58:06 +02:00
Don't crash the server if there's no devices
Big ninny just crashed because there's no fingerprint readers. Hoo, hoo. My eyes are bleeding.
This commit is contained in:
parent
9743d9d2a0
commit
1abf51afa4
3 changed files with 3 additions and 26 deletions
|
|
@ -70,7 +70,6 @@ typedef struct FprintManager FprintManager;
|
|||
typedef struct FprintManagerClass FprintManagerClass;
|
||||
|
||||
FprintManager *fprint_manager_new(gboolean no_timeout);
|
||||
GError *fprint_manager_get_error(FprintManager *manager);
|
||||
GType fprint_manager_get_type(void);
|
||||
|
||||
/* Device */
|
||||
|
|
|
|||
|
|
@ -346,12 +346,6 @@ int main(int argc, char **argv)
|
|||
/* create the one instance of the Manager object to be shared between
|
||||
* all fprintd users */
|
||||
manager = fprint_manager_new(no_timeout);
|
||||
error = fprint_manager_get_error (manager);
|
||||
if (error != NULL) {
|
||||
g_error("Couldn't create manager object: %s", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
driver_proxy = dbus_g_proxy_new_for_name(fprintd_dbus_conn,
|
||||
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ G_DEFINE_TYPE(FprintManager, fprint_manager, G_TYPE_OBJECT);
|
|||
|
||||
typedef struct
|
||||
{
|
||||
GError *last_error;
|
||||
GSList *dev_registry;
|
||||
gboolean no_timeout;
|
||||
guint timeout_id;
|
||||
|
|
@ -55,8 +54,6 @@ static void fprint_manager_finalize(GObject *object)
|
|||
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (object);
|
||||
|
||||
g_slist_free(priv->dev_registry);
|
||||
if (priv->last_error)
|
||||
g_error_free (priv->last_error);
|
||||
|
||||
G_OBJECT_CLASS(parent_class)->finalize(object);
|
||||
}
|
||||
|
|
@ -123,15 +120,12 @@ fprint_manager_init (FprintManager *manager)
|
|||
struct fp_dscv_dev *ddev;
|
||||
int i = 0;
|
||||
|
||||
if (!discovered_devs) {
|
||||
priv->last_error = g_error_new (FPRINT_ERROR, FPRINT_ERROR_INTERNAL,
|
||||
_("An internal error occurred in libfprint"));
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_g_connection_register_g_object(fprintd_dbus_conn,
|
||||
"/net/reactivated/Fprint/Manager", G_OBJECT(manager));
|
||||
|
||||
if (discovered_devs == NULL)
|
||||
return;
|
||||
|
||||
while ((ddev = discovered_devs[i++]) != NULL) {
|
||||
FprintDevice *rdev = fprint_device_new(ddev);
|
||||
gchar *path;
|
||||
|
|
@ -162,16 +156,6 @@ FprintManager *fprint_manager_new(gboolean no_timeout)
|
|||
return FPRINT_MANAGER (object);
|
||||
}
|
||||
|
||||
GError *fprint_manager_get_error(FprintManager *manager)
|
||||
{
|
||||
FprintManagerPrivate *priv = FPRINT_MANAGER_GET_PRIVATE (manager);
|
||||
|
||||
if (priv->last_error == NULL)
|
||||
return NULL;
|
||||
|
||||
return g_error_copy (priv->last_error);
|
||||
}
|
||||
|
||||
static gboolean fprint_manager_get_devices(FprintManager *manager,
|
||||
GPtrArray **devices, GError **error)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue