summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXRegion.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-08-21 14:06:54 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-08-21 14:06:54 (GMT)
commitaa7b5aca7453deb72f795bcac257cb64ee9fe76e (patch)
tree5ab0edff8ccd94cacd9aba35feecb823a0548d67 /macosx/tkMacOSXRegion.c
parentc3a1c1de43aa94d3bd7fafe4e993976573caa782 (diff)
parent6560e31a6006a2aec8c95564ec8287088c2e11de (diff)
downloadtk-aa7b5aca7453deb72f795bcac257cb64ee9fe76e.zip
tk-aa7b5aca7453deb72f795bcac257cb64ee9fe76e.tar.gz
tk-aa7b5aca7453deb72f795bcac257cb64ee9fe76e.tar.bz2
Merge 8.6
Diffstat (limited to 'macosx/tkMacOSXRegion.c')
-rw-r--r--macosx/tkMacOSXRegion.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index 0a5ff6d..59eca6c 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -12,6 +12,16 @@
*/
#include "tkMacOSXPrivate.h"
+static void RetainRegion(TkRegion r);
+static void ReleaseRegion(TkRegion r);
+
+#ifdef DEBUG
+static int totalRegions = 0;
+static int totalRegionRetainCount = 0;
+#define DebugLog(msg, ...) fprintf(stderr, (msg), ##__VA_ARGS__)
+#else
+#define DebugLog(msg, ...)
+#endif
/*
@@ -34,7 +44,10 @@
Region
XCreateRegion(void)
{
- return (Region) HIShapeCreateMutable();
+ Region region = (Region) HIShapeCreateMutable();
+ DebugLog("Created region: total regions = %d\n", ++totalRegions);
+ RetainRegion(region);
+ return region;
}
/*
@@ -59,7 +72,8 @@ XDestroyRegion(
Region r)
{
if (r) {
- CFRelease(r);
+ DebugLog("Destroyed region: total regions = %d\n", --totalRegions);
+ ReleaseRegion(r);
}
return Success;
}
@@ -320,7 +334,7 @@ TkpBuildRegionFromAlphaData(
/*
*----------------------------------------------------------------------
*
- * TkpRetainRegion --
+ * RetainRegion --
*
* Increases reference count of region.
*
@@ -333,17 +347,18 @@ TkpBuildRegionFromAlphaData(
*----------------------------------------------------------------------
*/
-void
-TkpRetainRegion(
+static void
+RetainRegion(
Region r)
{
CFRetain(r);
+ DebugLog("Retained region: total count is %d\n", ++totalRegionRetainCount);
}
/*
*----------------------------------------------------------------------
*
- * TkpReleaseRegion --
+ * ReleaseRegion --
*
* Decreases reference count of region.
*
@@ -356,11 +371,12 @@ TkpRetainRegion(
*----------------------------------------------------------------------
*/
-void
-TkpReleaseRegion(
+static void
+ReleaseRegion(
Region r)
{
CFRelease(r);
+ DebugLog("Released region: total count is %d\n", --totalRegionRetainCount);
}
/*