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

[Windows] StageWebView::stage=null cause crash #183

Closed
itlancer opened this issue Dec 19, 2019 · 2 comments
Closed

[Windows] StageWebView::stage=null cause crash #183

itlancer opened this issue Dec 19, 2019 · 2 comments

Comments

@itlancer
Copy link

Problem Description

When you set StageWebView::stage property to null (stageWebView.stage = null) and then set StageWebView instance to null (stageWebView = null) it cause application crash with MSHTML.dll Application Error with Windows devices.
Sometimes it couldn't be reproducible 100%, just try again.
I think it could be Garbage Collection problem or something like that.
Also this issue causes big problems for high load applications with many StageWebView instances (only 1 displaying in one moment).

Tested with multiple AIR versions even with latests AIR 32.0.0.89, AIR 32.0.0.144 beta and AIR 33.0.2.338 with multiple Windows devices with different OS versions with 32-bit and 64-bit AIR applications with captive runtime.
Same problem in all cases.
It works fine with macOS, Android and iOS.

Related issues:
https://tracker.adobe.com/#/view/AIR-3915039
https://forum.starling-framework.org/d/15593-windows-stagewebviewstagenull-cause-crash
https://community.adobe.com/t5/air/windows-setting-stagewebview-instance-to-null-after-stagewebview-stage-null-cause-crash/td-p/6774486

Steps to Reproduce

Launch code belowand wait 3 seconds (stage property of StageWebView will be set to null and StageWebView instance nulled).

Application example with sources attached.
stagewebview_stage_crash.zip

package {
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.media.StageWebView;
	import flash.geom.Rectangle;
	
	public class StageWebViewStageCrash extends Sprite {
		private var stageWebView:StageWebView;
		
		public function StageWebViewStageCrash() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			stageWebView = new StageWebView(true);
			stageWebView.loadURL("https://airsdk.harman.com/");
			stageWebView.viewPort = new Rectangle(100, 100, 640, 480);
			stageWebView.stage = stage;
			
			var timer:Timer = new Timer(3000, 1);
			timer.addEventListener(TimerEvent.TIMER_COMPLETE, timeout);
			timer.start();
		}
		
		private function timeout(e:TimerEvent):void {
			stageWebView.stop();
			
			//stageWebView.dispose();//Workaround: use this line instead of line below 
			stageWebView.stage = null;//This line cause crash
			
			stageWebView = null;
		}
	}
}

Actual Result:
Application crashes with MSHTML.dll Application Error:

Problem signature:
  Problem Event Name:	APPCRASH
  Faulting application name:	adl.exe
  version:	33.0.2.338
  time stamp:	5dec5530
  Faulting module name:	MSHTML.dll
  version:	11.0.9600.17239
  time stamp:	53d26078
  Exception code:	c0000005
  Fault offset:	0045b406
  OS Version:	6.3.9600.2.0.0.256.48
  Locale ID:	1049
  Additional Information 1:	5861
  Additional Information 2:	5861822e1919d7c014bbb064c64908b2
  Additional Information 3:	d1d9
  Additional Information 4:	d1d94a13d3609d6b740644c12508f581

Expected Result:
StageWebView correctly removed from stage without crashes.

Known Workarounds

Workaround (with Josh Tynjala help):
https://forum.starling-framework.org/topic/windows-stagewebviewstagenull-cause-crash?replies=4#post-114036
Use stageWebView.dispose() instead of stageWebView.stage=null.

@itlancer
Copy link
Author

It works better with latest AIR versions (less crashes) with packaged application and happens in complex cases (not isolated sample).
But with isolated sample crash still reproducible by launching for test with Adobe Animate and even using <UseWebView2>true</UseWebView2>.

@itlancer
Copy link
Author

Fixed with latest AIR 33.1.1.743.
Thanks!

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

No branches or pull requests

2 participants