summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorculler <culler>2019-11-19 04:33:58 (GMT)
committerculler <culler>2019-11-19 04:33:58 (GMT)
commite15390471f6368e52215eb6ff7bd88d3185d66e1 (patch)
tree4baf784eef274fe4957192aab7e5b7a1096a394c /generic
parentc661c4d2a82f04eab51e05150e6d03dd6936b4cd (diff)
parent40d3397c7c92aa2d658346d57d8c0195cb06f1c8 (diff)
downloadtk-e15390471f6368e52215eb6ff7bd88d3185d66e1.zip
tk-e15390471f6368e52215eb6ff7bd88d3185d66e1.tar.gz
tk-e15390471f6368e52215eb6ff7bd88d3185d66e1.tar.bz2
Prevent crashes on macOS caused by calling TheWorldHasChanged from inside [NSView drawRect]
Diffstat (limited to 'generic')
-rw-r--r--generic/tkFont.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 86fdd87..156ebf3 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -13,7 +13,9 @@
#include "tkInt.h"
#include "tkFont.h"
-
+#if defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h"
+#endif
/*
* The following structure is used to keep track of all the fonts that exist
* in the current application. It must be stored in the TkMainInfo for the
@@ -872,7 +874,18 @@ TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
TkFontInfo *fiPtr = clientData;
+#if defined(MAC_OSX_TK)
+ /*
+ * On macOS it is catastrophic to recompute all widgets while the
+ * [NSView drawRect] method is drawing. The best that we can do in
+ * that situation is to abort the recomputation and hope for the best.
+ */
+
+ if (TkpAppIsDrawing()) {
+ return;
+ }
+#endif
fiPtr->updatePending = 0;
RecomputeWidgets(fiPtr->mainPtr->winPtr);
}