commit ec8f02ff2828f38187dcf93d49b66a7a13446d3a
parent d2ba45f615344cc8725e8c34878a431eda858a1c
Author: aabacchus <ben@bvnf.space>
Date: Tue, 29 Nov 2022 15:42:40 +0000
keep tp allocated so that it's available after leaving setup_sx for the callback
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/a.c b/a.c
@@ -70,6 +70,7 @@ pollin_cb(XtPointer client_data, int *source, XtInputId *id) {
int
setup_sx(int argc, char **argv) {
+ static struct textpair tp;
XtAppContext app;
Widget w[4];
@@ -80,7 +81,8 @@ setup_sx(int argc, char **argv) {
w[0] = MakeTextWidget("", 0, 0, 300, 200);
w[1] = MakeStringEntry(NULL, 200, string_cb, w[0]);
- struct textpair tp = {w[1], w[0]};
+ tp.in = w[1];
+ tp.out = w[0];
w[2] = MakeButton("Submit", submit_cb, &tp);
w[3] = MakeButton("Quit", quit, NULL);
@@ -106,6 +108,7 @@ int
main(int argc, char **argv) {
if (setup_sx(argc, argv) != 0)
return 1;
+
ShowDisplay();
GetStandardColors();
MainLoop();