Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

[3.0.0beta1] Crash on observing NSProgress #132

Closed
piercifani opened this issue Oct 12, 2016 · 4 comments
Closed

[3.0.0beta1] Crash on observing NSProgress #132

piercifani opened this issue Oct 12, 2016 · 4 comments

Comments

@piercifani
Copy link
Contributor

piercifani commented Oct 12, 2016

Hello,

Sorry to bug again, but I'm finding another crash when (attempting) to observe the progress of a task. I created a gist that again reproduces the crash.

Thanks for your time and I can't thank you enough for your work on this library!

@zwaldowski
Copy link
Contributor

It's no bother at all.

I'm sorry to say this issue is in the code your posted. ProgressObserver.observeValue(forKeyPath:of:change:context:) is implemented as:

    public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [String : Any]?, context: UnsafeMutableRawPointer?)

In Swift 3.0, at least, it should be:

    override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?)

@piercifani
Copy link
Contributor Author

I'm sorry but I'm seeing the same crash. Updated gist with fix to the observeValue method here.

@zwaldowski
Copy link
Contributor

You started making other changes to the code! 😁

A Progress instance needs to be created with the discreteProgress(totalUnitCount:) factory method. I'll see what I can do about working around requiring this, or if nothing else documenting it better. Thanks.

@piercifani
Copy link
Contributor Author

Hey Zach! Yes, I did change the code that created the Progress instances as a way of trying out different approaches, and it inadvertently got pushed to the gist, sorry about that.

I am still seeing issue in my real app, but for now I think it's related to my code. I'll dig deeper to find that out.

Thanks a lot!

PS: Yeah, it'll be great to have documented how to use the progress tracking feature of Task

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants