Spurious Build and Analyze warning for (assign) dispatch_queue_t properties

Originator:greg.cooksey
Number:rdar://20616953 Date Originated:2015-04-20
Status:Duplicate Resolved:No
Product:Developer Tools Product Version:6.3
Classification:UI / Usability Reproducible:Always
 
UPDATE: Closed as Duplicate of 20335433

Summary:
Xcode's Build and Analyze generates a spurious over-release warning in an object's -dealloc method when dispatch_release() is called for the ivar backing an assign dispatch_queue_t property.

Steps to Reproduce:
1. Create an iOS app project in Xcode
2. Load the attached files into the project
3. Ensure that DispatchQueueContainer.m is built without ARC
4. Run Build and Analyze

Expected Results:
No warnings are produced for DispatchQueueContainer

Actual Results:
"Incorrect decrement of the reference count of an object that is not owned at this point by the caller" warning is produced.

Version:
OS X 10.10.3 (14D131), Xcode 6.4 (6E7)

Notes:


Configuration:
This issue is present in Xcode 6.3 and Xcode 6.4 beta, and is not present in Xcode 6.2

Attached Files:

// DispatchQueueContainer.h

#import <UIKit/UIKit.h>

@interface DispatchQueueContainer : UIView

@end

---

// DispatchQueueContainer.m

#import "DispatchQueueContainer.h"

@interface DispatchQueueContainer ()

@property (nonatomic, assign) dispatch_queue_t queue;

@end

@implementation DispatchQueueContainer

- (instancetype)init {
    self = [super init];
    if (self) {
        _queue = dispatch_queue_create("Test queue", DISPATCH_QUEUE_SERIAL);
    }
    return self;
}

- (void)dealloc {
    dispatch_release(_queue);
    
    [super dealloc];
}

@end

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!