summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-07-28 15:08:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-08-13 11:07:21 +1000
commit619ca32202cd22f2a408586cbc906b8bbaeb9358 (patch)
treeb2c32dca49ddbbf2ac6302994c1f9c0ff4161b6f
parent1a172f3297369a72865232c382abfc14281102a4 (diff)
Xi: reset the unused classes pointer after copying
After copying the unused_classes into the device, reset the original pointer. Otherwise we have two pointers pointing to the same field and both get freed on device removal. Some classes already have this behaviour since 51c8fd69. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--Xi/exevents.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index e990aeb7e..e19e207fd 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -223,6 +223,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
classes = to->unused_classes;
to->intfeed = classes->intfeed;
+ classes->intfeed = NULL;
}
i = &to->intfeed;
@@ -258,6 +259,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
classes = to->unused_classes;
to->stringfeed = classes->stringfeed;
+ classes->stringfeed = NULL;
}
s = &to->stringfeed;
@@ -293,6 +295,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
classes = to->unused_classes;
to->bell = classes->bell;
+ classes->bell = NULL;
}
b = &to->bell;
@@ -329,6 +332,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
{
classes = to->unused_classes;
to->leds = classes->leds;
+ classes->leds = NULL;
}
l = &to->leds;
@@ -379,6 +383,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
to->kbdfeed = classes->kbdfeed;
if (!to->kbdfeed)
InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
+ classes->kbdfeed = NULL;
}
k = &to->kbdfeed;
@@ -506,6 +511,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
{
classes = to->unused_classes;
to->ptrfeed = classes->ptrfeed;
+ classes->ptrfeed = NULL;
}
p = &to->ptrfeed;