opentk / rift

Cross-platform Oculus Rift bindings for .Net and Mono
26 stars 9 forks source link

Segfault in Linq Query? #4

Open 0xc1c4da opened 10 years ago

0xc1c4da commented 10 years ago

Tried giving this a go today, built Test/GL1, used Nuget packages for OpenTK, OpenTK.Rift and OpenTK.Rift.Mac in Xamarin, and ran but seems to seg fault with;

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) OpenTK.Platform.MacOS.Carbon.CG.DisplayBounds (intptr) <0xffffffff>
  at OpenTK.Platform.MacOS.QuartzDisplayDeviceDriver..ctor () <0x00622>
  at OpenTK.Platform.MacOS.MacOSFactory.CreateDisplayDeviceDriver () <0x0002f>
  at OpenTK.DisplayDevice..cctor () <0x0004a>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>
  at <unknown> <0xffffffff>
  at otkRift.OTKRift.<RiftDisplay>m__0 (int) <0x00018>
  at System.Linq.Enumerable/<CreateSelectIterator>c__Iterator10`2<int, OpenTK.DisplayDevice>.MoveNext () <0x0012a>
  at System.Linq.Enumerable/<CreateWhereIterator>c__Iterator1E`1.MoveNext () <0x00223>
  at System.Linq.Enumerable.First<TSource> (System.Collections.Generic.IEnumerable`1<TSource>,System.Func`2<TSource, bool>,System.Linq.Enumerable/Fallback) <0x000c0>
  at System.Linq.Enumerable.FirstOrDefault<TSource> (System.Collections.Generic.IEnumerable`1<TSource>) <0x00087>
  at otkRift.OTKRift..cctor () <0x00207>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>

I tried various combinations of display mirroring and moving to and from Rift DK, didn't help, then I unpluggd and replugged, still didn't help. Then I tried one more time and it worked!

Closing the window then caused NullReferenceException on;

protected override void OnUnload(EventArgs e)
        {
            Rift.Dispose();
        }
thefiddler commented 10 years ago

Thanks for the bug report.

The NullReferenceException has been fixed in OpenTK 1.1.1, and OpenTK 1.1.2 (to be released tomorrow) comes with a new Cocoa-based backend that may fix the display device crash. The issue is that the NuGet package for OpenTK is slightly out of date (1.1.0) - I'll see if this can be somehow fixed.

In the meantime, you can drop libSDL2.dylib into your application folder to enable the SDL2 backend for OpenTK. This is known to be more stable on Mac OS X.

thefiddler commented 10 years ago

Is this still reproducible with OpenTK 1.1.2?