samvermette/SVProgressHUD — Issue #41: Bug: Memory management incorrect.
Author: pkluz
Created: 2012-01-02 22:59:48+00:00
State: open

Hey Sam, first of all - I just found your library and gotta say I really like it :) It just "feels" better than the others. Simple as :)

Sadly I haven't had time to read through the code yet but what I found is this:

`2012-01-02 23:44:56.090 SVProgressHUDTest[2265:707] *** -[UIWindow release]: message sent to deallocated instance 0x1f6260`

Here's the backtrace:

(gdb) bt
#0 0x3801c8a0 in ___forwarding___ ()
#1 0x37f77680 in __forwarding_prep_0___ ()
#2 0x00007c40 in __24-[SVProgressHUD dismiss]_block_invoke_0149 (.block_descriptor=, finished=1 '\001') at /Volumes/Development/nehira.com/SVProgressHUD/SVProgressHUD/SVProgressHUD.m:457
#3 0x353ed0be in -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] ()
#4 0x353e781a in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] ()
#5 0x353ecfb8 in -[UIViewAnimationState animationDidStop:finished:] ()
#6 0x33795ba6 in CA::Layer::run_animation_callbacks ()
#7 0x37cd7f7a in _dispatch_main_queue_callback_4CF$VARIANT$mp ()
#8 0x37fed2dc in __CFRunLoopRun ()
#9 0x37f704dc in CFRunLoopRunSpecific ()
#10 0x37f703a4 in CFRunLoopRunInMode ()
#11 0x37aeefcc in GSEventRunModal ()
#12 0x35400742 in UIApplicationMain ()
#13 0x00002802 in main (argc=1, argv=0x2fdffad0) at /Volumes/Development/nehira.com/SVProgressHUDTest/SVProgressHUDTest/main.m:15

On a footnote, I wouldn't recommend calling release on a property. This can result in unexpected behavior. On a sidenote, that's where it crashes:
`Line 457: [self.overlayWindow release];`

*How to replicate it:*
Well,... I just went mental and tapped the button which triggers my showInView: a bazillion times in a row :) What's the special thing about my case? Somewhere in between my delegate call (which is triggered if an asynchronous request finishes) will attempt to dismiss the HUD again. -> Crash.

*What might solve the issue:*
I don't really know yet because I haven't had time to actually read your code (as I'm using it for what it is :) - out of the box) but I'd start with implementing the singleton properly:
http://cocoasamurai.blogspot.com/2011/04/singletons-your-doing-them-wrong.html