Skip to content
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

Android: Crash with ObjectDisposedException when image is replaced very fast #164

Open
stephanpalmer opened this issue Dec 17, 2018 · 1 comment

Comments

@stephanpalmer
Copy link

When an SvgImage is removed from the view hierarchy very shortly after being added, the application crashes with an ObjectDisposedException. This is an Android-only issue, the exception occurs in the Android renderer. An example call stack is:

Xamarin Exception Stack:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SVG.Forms.Plugin.Droid.SvgImageRenderer'.
  at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <b9e19b24f26c438aa03726328fed6c8b>:0
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <b9e19b24f26c438aa03726328fed6c8b>:0
  at Android.Views.View.get_Context () [0x0000a] in <79c644c56f4d4229a048dfc47680a890>:0
  at SVG.Forms.Plugin.Droid.SvgImageRenderer+<>c__DisplayClass3_0.<OnElementChanged>b__2 () [0x00000] in <82309ee2f65d4687bc224baddc67a29a>:0
  at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <79c644c56f4d4229a048dfc47680a890>:0
  at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <79c644c56f4d4229a048dfc47680a890>:0
  at (wrapper dynamic-method) System.Object.11(intptr,intptr)

The attached project SvgCrash.zip reproduces the error. Just tap the button to produce the exception.

stephanpalmer added a commit to zauberzeug/Xamarin.Forms.Plugins that referenced this issue Dec 18, 2018
stephanpalmer added a commit to zauberzeug/Xamarin.Forms.Plugins that referenced this issue Dec 18, 2018
stephanpalmer added a commit to zauberzeug/Xamarin.Forms.Plugins that referenced this issue Dec 18, 2018
… when loading and rendering SvgImage in background thread on Android.
stephanpalmer added a commit to zauberzeug/Xamarin.Forms.Plugins that referenced this issue Dec 18, 2018
…ready disposed when mapping pixels to device pixels on Android.
stephanpalmer added a commit to zauberzeug/Xamarin.Forms.Plugins that referenced this issue Dec 18, 2018
@stephanpalmer
Copy link
Author

Changes in pull request #166 should fix this issue.

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

No branches or pull requests

1 participant