Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Fix issue disposing MediaElement #11417

Closed
wants to merge 2 commits into from
Closed

[iOS] Fix issue disposing MediaElement #11417

wants to merge 2 commits into from

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Fix issue disposing MediaElement on iOS.

Issues Resolved

  • fixes #11412

API Changes

None

Platforms Affected

  • iOS

Behavioral/Visual Changes

None

Before/After Screenshots

Not applicable

Testing Procedure

Launch Core Gallery and navigate to the issue 11412. Tap Play and Pause buttons a few times and then tap Stop; navigate back the previous page. Without exceptions the test has passed.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@samhouts samhouts added the i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often label Jul 13, 2020
@samhouts samhouts requested review from hartez and PureWeen July 13, 2020 16:37
@samhouts samhouts added this to In Review in 4.7.0 Jul 13, 2020
@samhouts samhouts added this to In Review in MediaElement Jul 13, 2020
@@ -131,8 +131,8 @@ protected override void Dispose(bool disposing)

RemoveStatusObserver();

_avPlayerViewController?.Player?.Pause();
_avPlayerViewController?.Player?.ReplaceCurrentItemWithPlayerItem(null);
_avPlayerViewController?.Dispose();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one will call before on element changed. maybe it will throw exceptions on ElementChange function

@samhouts
Copy link
Member

samhouts commented Aug 4, 2020

@jsuarezruiz Please resolve the conflicts! Thanks!

NM, I did it

@samhouts samhouts added the DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. label Aug 4, 2020
@samhouts samhouts removed this from In Review in 4.7.0 Aug 4, 2020
@samhouts samhouts added this to In Progress in vCurrent (4.8.0) Aug 4, 2020
@samhouts samhouts added this to the 4.8.0 milestone Aug 6, 2020
@samhouts
Copy link
Member

samhouts commented Aug 7, 2020

@samhouts
Copy link
Member

samhouts commented Aug 7, 2020

@npagare
Copy link

npagare commented Aug 7, 2020

Xamarin.Forms.4.8.0.4314.nupkg.zip

Fix in this package fails with following error output -

  • =================================================================
    Native Crash Reporting

  • =================================================================
    Got a segv while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.

  • =================================================================

  • =================================================================
    Native stacktrace:

  • =================================================================
    0x10835c355 - /Users/{user}/Library/Developer/CoreSimulator/Devices/7824C266-4C85-47C6-89FE-E2BF6C05D693/data/Containers/Bundle/Application/40D84FE6-E38C-407F-9924-A68FD189D609/{AppBundle}.iOS.app/{AppBundle}.iOS : mono_dump_native_crash_info
    0x1083507f5 - /Users/{user}/Library/Developer/CoreSimulator/Devices/7824C266-4C85-47C6-89FE-E2BF6C05D693/data/Containers/Bundle/Application/40D84FE6-E38C-407F-9924-A68FD189D609/{AppBundle}.iOS.app/{AppBundle}.iOS : mono_handle_native_crash
    0x10836367b - /Users/{user}/Library/Developer/CoreSimulator/Devices/7824C266-4C85-47C6-89FE-E2BF6C05D693/data/Containers/Bundle/Application/40D84FE6-E38C-407F-9924-A68FD189D609/{AppBundle}.iOS.app/{AppBundle}.iOS : mono_sigsegv_signal_handler_debug
    0x7fff522ab5fd - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x600003010780 - Unknown
    0x7fff259105a3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : NSKeyValueWillChangeWithPerThreadPendingNotifications
    0x7fff2095aa10 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : __109-[AVPlayer _runOnIvarAccessQueueOperationThatMayChangeCurrentItemWithPreflightBlock:modificationBlock:error:]_block_invoke.392
    0x7fff209fa9e9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVSerializedMostlySynchronousReentrantBlockScheduler scheduleBlock:]
    0x7fff2095a76f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer _runOnIvarAccessQueueOperationThatMayChangeCurrentItemWithPreflightBlock:modificationBlock:error:]
    0x7fff2095f1ae - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer replaceCurrentItemWithPlayerItem:]
    0x1085b27f9 - /Users/{user}/Library/Developer/CoreSimulator/Devices/7824C266-4C85-47C6-89FE-E2BF6C05D693/data/Containers/Bundle/Application/40D84FE6-E38C-407F-9924-A68FD189D609/{AppBundle}.iOS.app/{AppBundle}.iOS : xamarin_dyn_objc_msgSend
    0x11992f4a0 - Unknown

  • =================================================================
    Basic Fault Address Reporting

  • =================================================================
    Memory around native instruction pointer (0x7fff512525f1):0x7fff512525e1 08 5b 41 5e 41 5f 5d c3 48 85 ff 7e 09 48 8b 07 .[A^A_].H..~.H..
    0x7fff512525f1 8a 40 1c 24 01 c3 31 c0 c3 48 85 ff 74 17 78 1d .@.$..1..H.
    .t.x.
    0x7fff51252601 48 8b 07 48 85 c0 74 0d 48 89 c7 be 01 00 00 00 H..H..t.H...
    ....
    0x7fff51252611 e9 a0 d4 00 00 48 8d 05 5b 1c 02 00 c3 48 89 f8 ....
    .H..[....H..

  • =================================================================
    Managed Stacktrace:

  • =================================================================
    at <0xffffffff>
    at ObjCRuntime.Messaging:void_objc_msgSend_IntPtr <0x000ef>
    at AVFoundation.AVPlayer:ReplaceCurrentItemWithPlayerItem <0x001d2>
    at Xamarin.Forms.Platform.iOS.MediaElementRenderer:Dispose <0x00329>
    at Foundation.NSObject:Dispose <0x00074>
    at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x003fb>
    at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x00084>
    at Xamarin.Forms.Platform.iOS.VisualElementRenderer1:Dispose <0x00382> at Foundation.NSObject:Dispose <0x00074> at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x003fb> at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x00084> at Xamarin.Forms.Platform.iOS.VisualElementRenderer1:Dispose <0x00382>
    at Foundation.NSObject:Dispose <0x00074>
    at Xamarin.Forms.Platform.iOS.DisposeHelpers:DisposeModalAndChildRenderers <0x003e8>
    at Xamarin.Forms.Platform.iOS.Platform:HandleChildRemoved <0x000f2>
    at Xamarin.Forms.Element:OnDescendantRemoved <0x00130>
    at Xamarin.Forms.Element:OnDescendantRemoved <0x001ca>
    at Xamarin.Forms.Element:OnChildRemoved <0x001c2>
    at Xamarin.Forms.VisualElement:OnChildRemoved <0x000aa>
    at Xamarin.Forms.Page:OnInternalRemoved <0x0016c>
    at Xamarin.Forms.Page:InternalChildrenOnCollectionChanged <0x0034a>
    at System.Collections.ObjectModel.ObservableCollection1:OnCollectionChanged <0x000fa> at System.Collections.ObjectModel.ObservableCollection1:OnCollectionChanged <0x00103>
    at System.Collections.ObjectModel.ObservableCollection1:RemoveItem <0x0018a> at System.Collections.ObjectModel.Collection1:Remove <0x001e5>
    at d__79:MoveNext <0x008a2>
    at MoveNextRunner:InvokeMoveNext <0x000ab>
    at System.Threading.ExecutionContext:RunInternal <0x00585>
    at System.Threading.ExecutionContext:Run <0x00092>
    at MoveNextRunner:Run <0x001aa>
    at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
    at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
    at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
    at System.Threading.Tasks.Task:FinishContinuations <0x006b6>
    at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
    at System.Threading.Tasks.Task1:TrySetResult <0x0022a> at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult <0x002ca>
    at d__51:MoveNext <0x00aea>
    at MoveNextRunner:InvokeMoveNext <0x000ab>
    at System.Threading.ExecutionContext:RunInternal <0x00585>
    at System.Threading.ExecutionContext:Run <0x00092>
    at MoveNextRunner:Run <0x001aa>
    at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
    at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
    at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
    at System.Threading.Tasks.Task:FinishContinuations <0x006b6>
    at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
    at System.Threading.Tasks.Task1:TrySetResult <0x0022a> at System.Threading.Tasks.TaskCompletionSource1:TrySetResult <0x00092>
    at System.Threading.Tasks.TaskCompletionSource`1:SetResult <0x0007a>
    at <>c__DisplayClass57_0:b__3 <0x00092>
    at Foundation.NSAsyncActionDispatcher:Apply <0x0006e>
    at System.Object:runtime_invoke_void__this__ <0x000e5>
    at <0xffffffff>
    at UIKit.UIApplication:UIApplicationMain <0x00254>
    at UIKit.UIApplication:Main <0x000b2>
    at UIKit.UIApplication:Main <0x00132>
    at com.{AppBundle}.iOS.Application:Main <0x00092>
    at :runtime_invoke_void_object <0x00352>

  • =================================================================

@samhouts samhouts added the retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. label Aug 13, 2020
@Agredo
Copy link

Agredo commented Sep 1, 2020

Is there a workaround?

@samhouts samhouts removed this from In Progress in vCurrent (4.8.0) Sep 2, 2020
@rmarinho
Copy link
Member

MediaElement moved to XTC

@rmarinho rmarinho closed this Sep 10, 2020
MediaElement automation moved this from In Review to Done Sep 10, 2020
@npagare
Copy link

npagare commented Sep 10, 2020

Hello @rmarinho , @samhouts ,

How are you we going to track this issue under XTC ? Is there a mirror image of this github issue under XTC ?

Thank you

@PureWeen PureWeen deleted the fix-11412 branch January 7, 2021 22:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/mediaelement DO-NOT-MERGE-!!! 🛑 This is in progress and needs to be updated before it can be merged. i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 retarget-branch-required PR or associated issues target a milestone. Please target this PR to the matching branch. t/bug 🐛
Projects
No open projects
MediaElement
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

8 participants