summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Fl_cocoa.mm3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index eee31a9d7..20fe0d1ef 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -293,11 +293,11 @@ static DataReady dataready;
void DataReady::AddFD(int n, int events, void (*cb)(int, void*), void *v)
{
- fl_open_display(); // necessary for NSApp to be defined
RemoveFD(n, events);
int i = nfds++;
if (i >= fd_array_size)
{
+ fl_open_display(); // necessary for NSApp to be defined and the event loop to work
FD *temp;
fd_array_size = 2*fd_array_size+1;
if (!fds) { temp = (FD*)malloc(fd_array_size*sizeof(FD)); }
@@ -544,6 +544,7 @@ static void realloc_timers()
{
if (mac_timer_alloc == 0) {
mac_timer_alloc = 8;
+ fl_open_display(); // needed because the timer creates an event
}
mac_timer_alloc *= 2;
MacTimeout* new_timers = new MacTimeout[mac_timer_alloc];