aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-01-28 15:54:21 -0500
committerGitHub <noreply@github.com>2018-01-28 15:54:21 -0500
commit60b2d969e07e24ed1b96ccc9d82bc2f9c1d540f2 (patch)
tree12afecb38738a67baef07dfe2374d6bd10cf2822
parentf0b3a71fbc72eeccf44bc6a6f6c39a80af918463 (diff)
parent5bbff20b8d593ad55efa4b31ea520519d6d988c9 (diff)
Merge pull request #591 from emersion/fix-data-source-notify-finish
Fix assertion failed in data_source_notify_finish
-rw-r--r--types/wlr_data_device.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c
index 5a6bc198..c359be79 100644
--- a/types/wlr_data_device.c
+++ b/types/wlr_data_device.c
@@ -173,16 +173,19 @@ static void data_offer_resource_destroy(struct wl_resource *resource) {
goto out;
}
- offer->source->offer = NULL;
-
// If the drag destination has version < 3, wl_data_offer.finish
// won't be called, so do this here as a safety net, because
// we still want the version >= 3 drag source to be happy.
if (wl_resource_get_version(offer->resource) <
WL_DATA_OFFER_ACTION_SINCE_VERSION) {
data_source_notify_finish(offer->source);
+ offer->source->offer = NULL;
} else if (offer->source->dnd_finish) {
+ // source->cancel can free the source
+ offer->source->offer = NULL;
offer->source->cancel(offer->source);
+ } else {
+ offer->source->offer = NULL;
}
out: