changeset 107:5ac0a5d00e19

Fix: GPollFD should be allocated via malloc
author Frank Benoit <benoit@tionex.de>
date Fri, 18 Jan 2008 21:08:15 +0100
parents 396a9fa07672
children 0f12f6bb9739
files dwt/widgets/Display.d
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/widgets/Display.d	Fri Jan 18 20:53:49 2008 +0100
+++ b/dwt/widgets/Display.d	Fri Jan 18 21:08:15 2008 +0100
@@ -3644,7 +3644,8 @@
     if (getMessageCount () !is 0) return true;
     if (fds is null) {
         allocated_nfds = 2;
-        fds = new GPollFD[ allocated_nfds ];
+        GPollFD* ptr = cast(GPollFD*) OS.g_malloc( GPollFD.sizeof * allocated_nfds );
+        fds = ptr[ 0 .. allocated_nfds ];
     }
     max_priority = timeout = 0;
     auto context = OS.g_main_context_default ();
@@ -3656,7 +3657,8 @@
             while ((nfds = OS.g_main_context_query (context, max_priority, &timeout, fds.ptr, allocated_nfds)) > allocated_nfds) {
                 OS.g_free (fds.ptr);
                 allocated_nfds = nfds;
-                fds = new GPollFD[allocated_nfds];
+                GPollFD* ptr = cast(GPollFD*) OS.g_malloc( GPollFD.sizeof * allocated_nfds );
+                fds = ptr[ 0 .. allocated_nfds ];
             }
             GPollFunc poll = OS.g_main_context_get_poll_func (context);
             if (poll !is null) {