lmahdi / as3-arduino-connector

Automatically exported from code.google.com/p/as3-arduino-connector
0 stars 0 forks source link

AIR crashes after dispose. #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Nicholas, congratulations for this, would like to help testing, if I may... 
see below.

What steps will reproduce the problem?

//Simples code to testing.

<fx:Script>
<![CDATA[
import com.quetwo.Arduino.ArduinoConnector;

public var arduino:ArduinoConnector;

protected function init():void{
trace("#init.");                
arduino = new ArduinoConnector();
}

protected function bOpen_clickHandler(event:MouseEvent):void
{               
trace("#Port is open? "+ arduino.portOpen);                 
}

protected function bConn_clickHandler(event:MouseEvent):void
{               
arduino.connect("COM13");
}

protected function bClose_clickHandler(event:MouseEvent):void
{               
arduino.dispose();
}

]]>
</fx:Script>

<mx:Button id="bOpen" x="10" y="10" label="OPEN" 
click="bOpen_clickHandler(event)"/>
<mx:Button id="bConn" x="77" y="10" label="CONN" 
click="bConn_clickHandler(event)"/>
<mx:Button id="bClose" x="143" y="10" label="CLOSE" 
click="bClose_clickHandler(event)"/>

What is the expected output? What do you see instead?

1. I set COM13, the system return COM12, that not exist.

2. The COM port remains open, even after dispose.

3. The AIR crashes after dispose and closing the program. 
Perhaps, because port is already open.

What version of the product are you using? On what operating system?

Adobe Flash Builder 4.6 (build 328916) "Official licensed".
Adobe AIR 3.1.0.4880
Windows 7 Ultimate 64 bits "DELL Official licensed".
PS: I had to copy the DLLs to the folder SysWOW64, I saw the last issue.

Please provide any additional information below.

Below, my console:

[SWF] com.quetwo.Arduino.ArduinoConnector - 6,684 bytes after decompression
[SWF] FX232.swf - 2,030,059 bytes after decompression
#init.
[ArduinoConnector] Initalizing ANE...
#Port is open? false
[ArduinoConnector] Opening COM port 12  success =  true
#Port is open? true
[ArduinoConnector] Unloading ANE...
#Port is open? true
[ArduinoConnector] Unloading ANE...
#Port is open? true
Error: Error #3501: The extension context has already been disposed.
    at flash.external::ExtensionContext/_call()
    at flash.external::ExtensionContext/call()
    at com.quetwo.Arduino::ArduinoConnector/connect()[C:\Users\Nicholas Kwiatkowski\Adobe Flash Builder 4.6\SerialANELib\src\com\quetwo\Arduino\ArduinoConnector.as:70]
    at test232/bConn_clickHandler()[C:\Projetos\Fx\FX232\src\test232.mxml:26]
    at test232/__bConn_click()[C:\Projetos\Fx\FX232\src\test232.mxml:38]

The AIR crash error.

Problem Event Name: BEX
Application Name:   adl.exe
Application Version:    3.1.0.4880
Application Timestamp:  4eb7612e
Fault Module Name:  libSerialANE.dll_unloaded
Fault Module Version:   0.0.0.0
Fault Module Timestamp: 4ecfdafd
Exception Offset:   6b7c1b04
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.1.7601.2.1.0.256.1
Locale ID:  1046
Additional Information 1:   0a9e
Additional Information 2:   0a9e372d3b4ad19135b953a78882e789
Additional Information 3:   0a9e
Additional Information 4:   0a9e372d3b4ad19135b953a78882e789

If I can help with anything else, call me.

Best regards.

Marco

Original issue reported on code.google.com by mcost...@gmail.com on 9 Dec 2011 at 1:54

GoogleCodeExporter commented 8 years ago
The port number you are seeing is actually the "file handle" number, not the 
actual COM port number.  In 1.0.0, the trace statement has been updated to 
reflect that.

The COM port reporting closed has also been fixed in 1.0.0.  

The error you are reporting seems to be happening because the dispose() 
function is being called twice.  It should only be called a single time.  I 
will write a check in the function to make sure the DLL is not attempted to 
unload when it was not already in a loaded state.

Original comment by Nicholas...@gmail.com on 9 Dec 2011 at 3:51

GoogleCodeExporter commented 8 years ago
I know, I called dispose twince purposely to see portOpen return false. I'm 
anxious waiting the new version. Thank you for your attention.

Best regards.

Original comment by mcost...@gmail.com on 9 Dec 2011 at 4:21

GoogleCodeExporter commented 8 years ago
I'm syncing the changes to the code right now.  I should be able to post the 
new 1.0.0 download tomorrow.  (You can grab the new binary in the svn, if you 
want to try it out to see if it helps at all).

Original comment by Nicholas...@gmail.com on 9 Dec 2011 at 4:26

GoogleCodeExporter commented 8 years ago
Great, I'll make some codes here to testing all functions and helping to 
report. Regards.

Original comment by mcost...@gmail.com on 9 Dec 2011 at 4:34

GoogleCodeExporter commented 8 years ago
Nice... tested! Works great! I'll continue testing and reporting some news, if 
you need helping call me. Best regards.

Here some code to testing, if someone needs.

import com.quetwo.Arduino.ArduinoConnector;

public var arduino:ArduinoConnector;
public var timer:Timer;

protected function init():void{
trace("#init.");                

timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER,onTimer,false,0,true);                                      
if(arduino==null){
arduino = new ArduinoConnector();
}
}

protected function onTimer(e:TimerEvent):void{
if(arduino.bytesAvailable>0){
trace("#Read: "+ arduino.readBytesAsString());
}                   
}

protected function bOpen_clickHandler(event:MouseEvent):void
{               
if(arduino!=null){
trace("#Port is open? "+ arduino.portOpen);
}
}

protected function bConn_clickHandler(event:MouseEvent):void
{       
if(arduino!=null){
arduino.connect(this.txCOM.text);
}
}

protected function bClose_clickHandler(event:MouseEvent):void
{               
if(arduino.portOpen){
arduino.dispose();  
}else{
arduino = null;
}                                           
}

protected function bWrite_clickHandler(event:MouseEvent):void
{
if(arduino.portOpen){
arduino.writeString(this.txWriteData.text);
arduino.flush();
}
}

protected function bRead_clickHandler(event:MouseEvent):void
{               
if(timer!=null){
timer.start();  
}
}

protected function bReadStop_clickHandler(event:MouseEvent):void
{
if(timer!=null){
timer.stop();
timer.reset();
}
}

protected function bInit_clickHandler(event:MouseEvent):void
{
init();
}

]]>
</fx:Script>

<mx:Button id="bOpen" x="10" y="10" width="150" label="COM IS OPEN?" 
click="bOpen_clickHandler(event)"/>
<mx:Button id="bConn" x="10" y="40" width="150" label="COM OPEN!" 
click="bConn_clickHandler(event)"/>
<mx:Button id="bClose" x="10" y="70" width="150" label="COM CLOSE!" 
click="bClose_clickHandler(event)"/>
<mx:Button id="bWrite" x="10" y="100" width="150" label="WRITE DATA!" 
click="bWrite_clickHandler(event)"/>
<mx:TextInput id="txCOM" x="168" y="40" width="50" text="COM13"/>
<mx:Button id="bRead" x="10" y="130" width="150" label="READ DATA!" 
click="bRead_clickHandler(event)"/>
<mx:Button id="bReadStop" x="168" y="130" label="STOP" 
click="bReadStop_clickHandler(event)"/>
<mx:TextInput id="txWriteData" x="168" y="100"/>
<mx:Button id="bInit" x="168" y="70" label="INIT" 
click="bInit_clickHandler(event)"/>

Original comment by mcost...@gmail.com on 9 Dec 2011 at 4:58

GoogleCodeExporter commented 8 years ago
Issue closed with release of 1.0.0

Original comment by Nicholas...@gmail.com on 18 Dec 2011 at 4:23

GoogleCodeExporter commented 8 years ago
I'm still seeing this issue in 1.2.0 with AIR 3.3

  Problem Event Name:   BEX
  Application Name: adl.exe
  Application Version:  3.3.0.3650
  Application Timestamp:    4fc847e7
  Fault Module Name:    libSerialANE.dll_unloaded
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   4f6e5872
  Exception Offset: 6b7c1b70
  Exception Code:   c0000005
  Exception Data:   00000008
  OS Version:   6.1.7601.2.1.0.256.4
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Original comment by rvanderl...@appliedart.com on 12 Sep 2012 at 4:17

GoogleCodeExporter commented 8 years ago
I'm getting the same issue as  rvanderl...@appliedart.com on WindowsXP.  
Everything works fine on Windows7 though.

Original comment by andytwo...@gmail.com on 27 Sep 2012 at 7:35

GoogleCodeExporter commented 8 years ago
Sme problem with Windows7/64bit, AIR 3.4, and ArduinoConnector 1.2.0

Nombre del evento de problema:  BEX
  Nombre de la aplicación: Arduino.exe
  Versión de la aplicación:   0.0.0.0
  Marca de tiempo de la aplicación:    4f45e09b
  Nombre del módulo con errores:   libSerialANE.dll_unloaded
  Versión del módulo con errores: 0.0.0.0
  Marca de tiempo del módulo con errores:  4f6e5872
  Desplazamiento de excepción: 6b7c1b70
  Código de excepción:    c0000005
  Datos de excepción:  00000008
  Versión del sistema operativo:   6.1.7600.2.0.0.256.1
  Id. de configuración regional:   9226
  Información adicional 1: 0a9e
  Información adicional 2: 0a9e372d3b4ad19135b953a78882e789
  Información adicional 3: 0a9e
  Información adicional 4: 0a9e372d3b4ad19135b953a78882e789

Any solution?

Original comment by diegod...@pixeltween.com on 23 Oct 2012 at 2:49

GoogleCodeExporter commented 8 years ago
same problem with Windows7/32bit, AIR 3.4, and ArduinoConnector 1.5.0

but it seems work well in first time,but when I open and close the app very 
quickly,after 2 or 3 times.It will crash again?

Original comment by 764074...@qq.com on 30 Sep 2013 at 9:40