Peter Hosey avatar Peter Hosey committed 18c0b5b

Committing some code to log a message whenever a bridge gets deallocated, in order to help debug #157.

Comments (0)

Files changed (1)


 #import "GrowlDisplayWindowController.h"
+#include <execinfo.h>
 //Used to silence a warning when forwarding one of these messages to the display or notification.
 @protocol WindowControllerListener <NSObject>
 - (void) dealloc {
+	{
+		enum { maxStackHeight = 64 };
+		void *stackAddresses[maxStackHeight];
+		int numAddresses = backtrace(stackAddresses, maxStackHeight);
+		char **symbolsUTF8 = backtrace_symbols(stackAddresses, numAddresses);
+		NSMutableArray *stackTraceSymbols = [NSMutableArray arrayWithCapacity:numAddresses];
+		for (int i = 0; i < numAddresses; ++i) {
+			[stackTraceSymbols addObject:[NSString stringWithUTF8String:symbolsUTF8[i]]];
+		}
+		NSLog(@"%@ deallocating; stack trace:\n%@\n"@"window controllers: %@", self, stackTraceSymbols, windowControllers);
+		free(symbolsUTF8);
+	}
 	[windowControllers release];
 	[notification release];
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.