summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcryptogopher <xfce@michalczyk.pro>2020-11-06 01:27:25 +0100
committercryptogopher <xfce@michalczyk.pro>2020-11-06 01:27:25 +0100
commit921321d269b8c07097c0df78b5a7e33dc02bb4db (patch)
treead150c1102774833c5a2416a9a75ea5b12c9e976
parent700220faaba0f693b0e428eead90c15e20e6793f (diff)
downloadxfconf-921321d269b8c07097c0df78b5a7e33dc02bb4db.tar.gz
Test for #16
-rw-r--r--configure.ac.in1
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/others/Makefile.am6
-rw-r--r--tests/others/t-issue-16.c46
4 files changed, 54 insertions, 0 deletions
diff --git a/configure.ac.in b/configure.ac.in
index 1255d24..ad2ea41 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -230,6 +230,7 @@ tests/get-properties/Makefile
tests/reset-properties/Makefile
tests/object-bindings/Makefile
tests/property-changed-signal/Makefile
+tests/others/Makefile
tests/tests-end/Makefile
xfconf/Makefile
xfconf/libxfconf-0.pc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f1b06c0..96ed2a8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,6 +6,7 @@ SUBDIRS = \
reset-properties \
property-changed-signal \
object-bindings \
+ others \
tests-end
# list-channels
diff --git a/tests/others/Makefile.am b/tests/others/Makefile.am
new file mode 100644
index 0000000..2136eab
--- /dev/null
+++ b/tests/others/Makefile.am
@@ -0,0 +1,6 @@
+check_PROGRAMS = \
+ t-issue-16
+
+t_issue_16_SOURCES = t-issue-16.c
+
+include $(top_srcdir)/tests/Makefile.inc
diff --git a/tests/others/t-issue-16.c b/tests/others/t-issue-16.c
new file mode 100644
index 0000000..c7473f3
--- /dev/null
+++ b/tests/others/t-issue-16.c
@@ -0,0 +1,46 @@
+/*
+ * xfconf
+ *
+ * Copyright (c) 2020 cryptogopher
+ *
+ * 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
+ * the Free Software Foundation; version 2 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "tests-common.h"
+
+int
+main(int argc, char **argv)
+{
+ XfconfChannel *channel;
+
+ if(!xfconf_tests_start())
+ return 1;
+
+ /* Generate at least one asynchronous set_property call to trigger
+ * asynchronous callback execution. Because removal of the channel directly
+ * follows and callback will only be invoked after control returns to main
+ * loop - callback will be executed with dangling pointer to
+ * XfconfCacheOldItem. */
+ channel = xfconf_channel_new(TEST_CHANNEL_NAME);
+ xfconf_channel_reset_property (channel, test_int_property, FALSE);
+ TEST_OPERATION(xfconf_channel_set_int(channel, test_int_property, test_int));
+ g_object_unref(G_OBJECT(channel));
+
+ while (g_main_context_pending(NULL))
+ g_main_context_iteration(NULL, FALSE);
+
+ xfconf_tests_end();
+
+ return 0;
+}