[mutter] meta-backend: Fix the max device calculation on removal
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] meta-backend: Fix the max device calculation on removal
- Date: Thu, 4 Sep 2014 19:17:42 +0000 (UTC)
commit 27d6b2645e46ff0050db9324d40a95d54950bd4c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Sep 4 12:15:54 2014 -0700
meta-backend: Fix the max device calculation on removal
If we add device 2, then add device 254, then remove device 254, then
the max device ID will be 253. Scan through all the devices again on
removal to calculate a new max device ID.
src/backends/meta-backend.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index efcca94..1b179cd 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -119,8 +119,16 @@ destroy_device_monitor (MetaBackend *backend,
int device_id)
{
g_clear_object (&backend->device_monitors[device_id]);
+
if (device_id == backend->device_id_max)
- backend->device_id_max--;
+ {
+ /* Reset the max device ID */
+ int i, new_max = 0;
+ for (i = 0; i < backend->device_id_max; i++)
+ if (backend->device_monitors[i] != NULL)
+ new_max = i;
+ backend->device_id_max = new_max;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]