ZBar memory leak on iOS?

前端 未结 3 1655
再見小時候
再見小時候 2021-02-14 07:43

I am very satisfied with ZBar scanning performance, however I ran into a big problem on a project that runs under ARC if that counts at all.

Namely, it seems that there

3条回答
  •  不知归路
    2021-02-14 07:50

    Actually here is the code for the patch

    diff --git a/iphone/ZBarReaderViewController.m b/iphone/ZBarReaderViewController.m
    --- a/iphone/ZBarReaderViewController.m
    +++ b/iphone/ZBarReaderViewController.m
    @@ -320,8 +320,8 @@
    
     - (void) loadView
     {
    -    self.view = [[UIView alloc]
    -                    initWithFrame: CGRectMake(0, 0, 320, 480)];
    +    self.view = [[[UIView alloc]
    +                  initWithFrame: CGRectMake(0, 0, 320, 480)] autorelease];
     }
    
     - (void) viewDidLoad
    

    it's a .diff file, if you had access to the repo you could easily apply the patch but since this is a short one, you can also do that manually. You just have to add an autorelease call in loadView method of ZBarReaderViewController class

提交回复
热议问题