New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NSOpenGLPixelFormat ConvertToAttributes method #1539

Merged
merged 4 commits into from Feb 1, 2017

Conversation

Projects
None yet
6 participants
@timrisi
Member

timrisi commented Jan 20, 2017

From Bug #43250.

Trying to use a NSOpenGLProfile as an attribute, such as in:

var _attribs = new object [] { NSOpenGLPixelFormatAttribute.DoubleBuffer, NSOpenGLPixelFormatAttribute.DepthSize, 24, NSOpenGLPixelFormatAttribute.OpenGLProfile, NSOpenGLProfile.Version3_2Core, 0 }; NSOpenGLPixelFormat pixelFormat = new NSOpenGLPixelFormat (_attribs);

would cause the code to crash with an invalid cast exception when it tries to cast directly from NSOpenGLProfile to NSOpenGLPixelFormat: at line 61:

var v = (NSOpenGLPixelFormatAttribute) args [i];

This updates the code to first cast to an int before casting to NSOpenGLPixelFormatAttribute when the original value is another enum type.

@monojenkins

This comment has been minimized.

Show comment
Hide comment
@monojenkins

monojenkins Jan 20, 2017

Collaborator

Build success

Collaborator

monojenkins commented Jan 20, 2017

Build success

Show outdated Hide outdated src/AppKit/NSOpenGLPixelFormat.cs Outdated
@spouliot

+1 for tests

Add OpenGLProfile to list of NSOpenGLPixelFormatAttributes that requi…
…re a value. Check for 0 terminating the array
@timrisi

This comment has been minimized.

Show comment
Hide comment
@timrisi

timrisi Jan 21, 2017

Member

Tests coming next

Member

timrisi commented Jan 21, 2017

Tests coming next

@monojenkins

This comment has been minimized.

Show comment
Hide comment
@monojenkins

monojenkins Jan 21, 2017

Collaborator

Build failure

Collaborator

monojenkins commented Jan 21, 2017

Build failure

@rolfbjarne

This looks better 😄

Show outdated Hide outdated src/AppKit/NSOpenGLPixelFormat.cs Outdated
Show outdated Hide outdated src/AppKit/NSOpenGLPixelFormat.cs Outdated
Show outdated Hide outdated src/AppKit/NSOpenGLPixelFormat.cs Outdated
Show outdated Hide outdated src/AppKit/NSOpenGLPixelFormat.cs Outdated
@monojenkins

This comment has been minimized.

Show comment
Hide comment
@monojenkins

monojenkins Jan 25, 2017

Collaborator

Build failure

Collaborator

monojenkins commented Jan 25, 2017

Build failure

@timrisi

This comment has been minimized.

Show comment
Hide comment
@timrisi

timrisi Jan 25, 2017

Member

Failure looks to be unrelated, https://bugzilla.xamarin.com/show_bug.cgi?id=50419

Xamarin.Hosting: Launching com.xamarin.linksdk on 'iOS 10.2 (14C89) - iPhone 5s'
Failed to launch the simulator: Could not launch the app 'com.xamarin.linksdk' on the device 'iOS 10.2 (14C89) - iPhone 5s': The request to open "com.xamarin.linksdk" failed.
error MT1008: Failed to launch the simulator: Could not launch the app 'com.xamarin.linksdk' on the device 'iOS 10.2 (14C89) - iPhone 5s': The request to open "com.xamarin.linksdk" failed.
Test run failed
Could not find pid in mtouch output.
Test run crashed

Member

timrisi commented Jan 25, 2017

Failure looks to be unrelated, https://bugzilla.xamarin.com/show_bug.cgi?id=50419

Xamarin.Hosting: Launching com.xamarin.linksdk on 'iOS 10.2 (14C89) - iPhone 5s'
Failed to launch the simulator: Could not launch the app 'com.xamarin.linksdk' on the device 'iOS 10.2 (14C89) - iPhone 5s': The request to open "com.xamarin.linksdk" failed.
error MT1008: Failed to launch the simulator: Could not launch the app 'com.xamarin.linksdk' on the device 'iOS 10.2 (14C89) - iPhone 5s': The request to open "com.xamarin.linksdk" failed.
Test run failed
Could not find pid in mtouch output.
Test run crashed

@dalexsoto

Ok with me once Rolf's comments are addressed

@monojenkins

This comment has been minimized.

Show comment
Hide comment
@monojenkins

monojenkins Jan 27, 2017

Collaborator

Build failure

Collaborator

monojenkins commented Jan 27, 2017

Build failure

@timrisi

This comment has been minimized.

Show comment
Hide comment
@timrisi

timrisi Jan 27, 2017

Member

Failures unrelated (MediaPlayer made 64 bit by xcode 8.3 beta 1, fixed in another PR)

Member

timrisi commented Jan 27, 2017

Failures unrelated (MediaPlayer made 64 bit by xcode 8.3 beta 1, fixed in another PR)

@timrisi timrisi merged commit f3ebfc3 into xamarin:master Feb 1, 2017

1 check failed

Build Build failed. 7714 tests run, 109 skipped, 0 failed.
Details

timrisi pushed a commit that referenced this pull request Feb 6, 2017

Timothy Risi
Fix NSOpenGLPixelFormat ConvertToAttributes method (#1539) (#1613)
Fix NSOpenGLPixelFormat ConvertToAttributes

* Add OpenGLProfile to list of NSOpenGLPixelFormatAttributes that require a value.  Check for 0 terminating the array
* Use InitializeHandle instead of 'Handle = '
* Add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment