aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_impl.cpp
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2019-02-18 13:00:33 +0100
committerDan Gudmundsson <[email protected]>2019-02-18 13:00:33 +0100
commitd04ceae537e037555cb0ae962f3164dc6c499340 (patch)
tree7a11a18d336f662414dfeb7fb7b867fc5ce7d560 /lib/wx/c_src/wxe_impl.cpp
parent5ba931478460f2ed667f1ff145c3b0af4a00155e (diff)
parentd7805acb99f2b7ccd97541d189f6494966564d98 (diff)
downloadotp-d04ceae537e037555cb0ae962f3164dc6c499340.tar.gz
otp-d04ceae537e037555cb0ae962f3164dc6c499340.tar.bz2
otp-d04ceae537e037555cb0ae962f3164dc6c499340.zip
Merge branch 'dgud/wx/extend-functionality/OTP-15587' into maint
* dgud/wx/extend-functionality/OTP-15587: Fix showModal crash on Mojave Add wxGCDC wx: Add wxDisplay wx: Change wxFONTWEIGHT enums Let wxwidgets check events
Diffstat (limited to 'lib/wx/c_src/wxe_impl.cpp')
-rw-r--r--lib/wx/c_src/wxe_impl.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index bd22502d00..43b5476073 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -267,7 +267,7 @@ int WxeApp::dispatch_cmds()
return more;
}
-#define BREAK_BATCH 10000
+#define CHECK_EVENTS 10000
int WxeApp::dispatch(wxeFifo * batch)
{
@@ -278,13 +278,14 @@ int WxeApp::dispatch(wxeFifo * batch)
erl_drv_mutex_lock(wxe_batch_locker_m);
while(true) {
while((event = batch->Get()) != NULL) {
+ wait += 1;
erl_drv_mutex_unlock(wxe_batch_locker_m);
switch(event->op) {
case WXE_BATCH_END:
if(blevel>0) {
blevel--;
if(blevel==0)
- wait += BREAK_BATCH/4;
+ wait += CHECK_EVENTS/4;
}
break;
case WXE_BATCH_BEGIN:
@@ -314,21 +315,18 @@ int WxeApp::dispatch(wxeFifo * batch)
break;
}
event->Delete();
+ if(wait > CHECK_EVENTS)
+ return 1; // Let wx check for events
erl_drv_mutex_lock(wxe_batch_locker_m);
batch->Cleanup();
}
- if(blevel <= 0 || wait >= BREAK_BATCH) {
+ if(blevel <= 0) {
erl_drv_mutex_unlock(wxe_batch_locker_m);
- if(blevel > 0) {
- return 1; // We are still in a batch but we can let wx check for events
- } else {
- return 0;
- }
+ return 0;
}
// sleep until something happens
// fprintf(stderr, "%s:%d sleep %d %d %d\r\n", __FILE__, __LINE__, batch->m_n, blevel, wait);fflush(stderr);
wxe_needs_signal = 1;
- wait += 1;
while(batch->m_n == 0) {
erl_drv_cond_wait(wxe_batch_locker_c, wxe_batch_locker_m);
}