commit 24d8954

Michael Forney  ·  2014-02-27 02:56:03 +0000 UTC
parent d603a26
data: Set empty offer destructor after source is destroyed

This way we don't attempt to access the freed source link when removing
the offer link.
1 files changed,  +4, -1
+4, -1
 1@@ -1,6 +1,6 @@
 2 /* swc: data.c
 3  *
 4- * Copyright (c) 2013 Michael Forney
 5+ * Copyright (c) 2013, 2014 Michael Forney
 6  *
 7  * Permission is hereby granted, free of charge, to any person obtaining a copy
 8  * of this software and associated documentation files (the "Software"), to deal
 9@@ -116,7 +116,10 @@ static void data_destroy(struct wl_resource * source)
10      *
11      * So, we clear the user data on each of the offers to protect us. */
12     wl_resource_for_each(offer, &data->offers)
13+    {
14         wl_resource_set_user_data(offer, NULL);
15+        wl_resource_set_destructor(offer, NULL);
16+    }
17 
18     free(data);
19 }