summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-07-09 17:36:16 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-07-09 17:36:16 (GMT)
commit42519015c6b91dc2cc95571e0c2534e0f5209135 (patch)
tree6f3069c48e4dfc4aadff83f0058a3effc3346e70
parent9ce794ad641a7d75cf89e89cdc7f4da8e5293031 (diff)
parentd6c477519867f05c985cc5083ab0ad77ea69e453 (diff)
downloadtk-42519015c6b91dc2cc95571e0c2534e0f5209135.zip
tk-42519015c6b91dc2cc95571e0c2534e0f5209135.tar.gz
tk-42519015c6b91dc2cc95571e0c2534e0f5209135.tar.bz2
Fix [a526d42999]: Aqua: leak in TkpOpenDisplay(). Patch from Christopher Chavez.
-rw-r--r--macosx/tkMacOSXColor.c10
-rw-r--r--macosx/tkMacOSXXStubs.c3
2 files changed, 7 insertions, 6 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 15cf3df..2d481f9 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -382,6 +382,11 @@ SetCGColorComponents(
{
CGFloat rgba[4] = {0, 0, 0, 1};
+ if (entry->type == HIBrush) {
+ OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c);
+ return err == noErr;
+ }
+
/*
* This function is called before our autorelease pool is set up,
* so it needs its own pool.
@@ -389,11 +394,6 @@ SetCGColorComponents(
NSAutoreleasePool *pool = [NSAutoreleasePool new];
- if (entry->type == HIBrush) {
- OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c);
- [pool drain];
- return err == noErr;
- }
GetRGBA(entry, pixel, rgba);
*c = CGColorCreate(sRGB.CGColorSpace, rgba);
[pool drain];
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 9d7f1f7..c4df49e 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -187,7 +187,6 @@ TkpOpenDisplay(
const char *display_name)
{
Display *display;
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
if (gMacDisplay != NULL) {
if (strcmp(DisplayString(gMacDisplay->display), display_name) == 0) {
@@ -197,6 +196,8 @@ TkpOpenDisplay(
}
}
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL);
/*