[gtk+] Fix memleak in get_nsscreen_for_point()



commit 255c2739e2a1334bba969daa8ad95b80866fedc8
Author: Kristian Rietveld <kris gtk org>
Date:   Wed Dec 30 14:12:42 2009 +0100

    Fix memleak in get_nsscreen_for_point()
    
    One codepath did not go through GDK_QUARTZ_RELEASE_POOL, refactored
    the code to fix this.

 gdk/quartz/gdkwindow-quartz.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index f0bde1b..be7ee01 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -890,6 +890,7 @@ get_nsscreen_for_point (gint x, gint y)
 {
   int i;
   NSArray *screens;
+  NSScreen *screen = NULL;
 
   GDK_QUARTZ_ALLOC_POOL;
 
@@ -901,12 +902,15 @@ get_nsscreen_for_point (gint x, gint y)
 
       if (x >= rect.origin.x && x <= rect.origin.x + rect.size.width &&
           y >= rect.origin.y && y <= rect.origin.y + rect.size.height)
-        return [screens objectAtIndex:i];
+        {
+          screen = [screens objectAtIndex:i];
+          break;
+        }
     }
 
   GDK_QUARTZ_RELEASE_POOL;
 
-  return NULL;
+  return screen;
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]