X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdataset.c;fp=src%2Fdata%2Fdataset.c;h=7972a5ddcc75889586a9cd44fe09a4a56388edca;hb=a7db48f8f93e7262209e130dbaf876d88e22d087;hp=7a5a6a4a6a08a22749baf5340b9e71d709d66c51;hpb=5fbb67fa3559dd54bc225120b85458da3bb3245e;p=pspp diff --git a/src/data/dataset.c b/src/data/dataset.c index 7a5a6a4a6a..7972a5ddcc 100644 --- a/src/data/dataset.c +++ b/src/data/dataset.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011, 2013, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -267,10 +267,12 @@ dataset_set_session (struct dataset *ds, struct session *session) { if (session != ds->session) { + dataset_ref (ds); if (ds->session != NULL) session_remove_dataset (ds->session, ds); if (session != NULL) session_add_dataset (session, ds); + dataset_unref (ds); } } @@ -974,5 +976,12 @@ dataset_transformations_changed__ (struct dataset *ds, bool non_empty) void dataset_set_session__ (struct dataset *ds, struct session *session) { - ds->session = session; + if (ds->session != session) + { + if (ds->session) + dataset_unref (ds->session); + ds->session = session; + if (session) + dataset_ref (session); + } }