summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2020-01-30 09:36:43 +0100
committerCamil Staps2020-01-30 09:36:43 +0100
commit52a64f70b45e8a10c4a3480f55f6ec6dd7ce1de6 (patch)
tree4a8dd74f5785c1e2ffda0bec3ada43ab59b7bc11
parentAdd support for populate-popup signal (diff)
Prevent state corruption in runWhileEventsPending; wrap in withPossibleCallbackHEADmaster
-rw-r--r--src/Gtk/State.icl16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Gtk/State.icl b/src/Gtk/State.icl
index 32c2b19..fde5cf0 100644
--- a/src/Gtk/State.icl
+++ b/src/Gtk/State.icl
@@ -109,10 +109,12 @@ quit :: GtkM ()
quit = modState (\st -> {st & return=True}) >>| pure ()
runWhileEventsPending :: GtkM ()
-runWhileEventsPending =
- toStateR gtk_events_pending >>= \pending
- | not pending ->
- pure ()
- | otherwise ->
- toStateR gtk_main_iteration >>|
- runWhileEventsPending
+runWhileEventsPending = withPossibleCallback run
+where
+ run =
+ toStateR gtk_events_pending >>= \pending
+ | not pending ->
+ pure ()
+ | otherwise ->
+ toStateR gtk_main_iteration >>|
+ run