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

App crashes in OnDraw (ObjectDisposedExceptionCannot) #27

Closed
25RBazookas opened this issue Oct 13, 2016 · 7 comments
Closed

App crashes in OnDraw (ObjectDisposedExceptionCannot) #27

25RBazookas opened this issue Oct 13, 2016 · 7 comments

Comments

@25RBazookas
Copy link

The PagerSlidingTabStrip crashes on a Samsung S7 Edge in the onDraw method.

System.ObjectDisposedExceptionCannot access a disposed object. Object name: 'Android.Graphics.Paint'. Raw Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self)<67d9ce838ca8443ba3ee57c49530f12a>:0 Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue* parameters)<67d9ce838ca8443ba3ee57c49530f12a>:0 Android.Graphics.Paint.set_Color(Color value)<7b54b5e3469b4fb0b2cef44ad5a5b85c>:0 com.refractored.PagerSlidingTabStrip.OnDraw(Canvas canvas)<b1427543c5704ae8bfee8048b832bfc1>:0 Android.Views.View.n_OnDraw_Landroid_graphics_Canvas_(IntPtr jnienv, IntPtr native__this, IntPtr native_canvas)<7b54b5e3469b4fb0b2cef44ad5a5b85c>:0 at (wrapper dynamic-method) System.Object:a757f904-7660-4d22-b077-c7e1696ab4d9 (intptr,intptr,intptr)

@25RBazookas
Copy link
Author

25RBazookas commented Oct 17, 2016

crashes on canvas.DrawRect(paddingLeft, height - underlineHeight, tabsContainer.Width + paddingRight, height, rectPaint); //This line crashes

It seems that Paint rectPaint; is disposed on the moment that the OnDraw method is called.

@25RBazookas
Copy link
Author

Had crash on Nexus 5 (Android 6 ) and Samsung S7 Edge (Android 7)

@jamesmontemagno
Copy link
Owner

Do you have a small sample to look at?

@jamesmontemagno
Copy link
Owner

Also, this library has now been deprecated by the new Android Support Design Library. Please see the full component for a sample: https://components.xamarin.com/view/xamandroidsupportdesign

@25RBazookas
Copy link
Author

Hello James
I will make a sample project which I will provide in the following days.

My app crashes if I return from an activity to the activity with the pagerslidingtabstrip. I suspect that the GarbageCollector will be a problem here.

I've tested your sample and it does not crash even if I open multiple activities. I'll keep you posted.

@troyanas
Copy link

troyanas commented Jun 1, 2017

Issue still exists

@jamesmontemagno
Copy link
Owner

This library is deprecated and not being updated: Use: https://components.xamarin.com/view/xamandroidsupportdesign

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

3 participants