• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Change Port in Class - Exception

Started by moelski, September 12, 2010, 11:31:34 am

Previous topic - Next topic

moelski

Hi Roman,

could you please take a look at the attached example?

Run it and press the create button ... The class is initiated. All is fine.
Click on the Change button and change the port ... All is fine.

Close the Dialog, press Change again and try to change the port.
You will get an exception. But why  ???  ???

Greetz Dominik

moelski

Hi Roman,

this is a really strange problem for me  :-\  I added a TNrDeviceBox to Form1. just adding - no nrcomm is assigned. So the DeviceBox is useless.

Run the app and it works without an error  ???

This is confusing me.

Roman Novgorodov

Hello

Yes. The following code resolves trouble in Source_NrComm_RS232 unit:

 
  ...
  TNrCommConfig(ConfigFrame).Set_Port(FPort_NrComm);
  Form.ShowModal;
  TNrCommConfig(ConfigFrame).Set_Port(nil); // <----------- new line !!!!!!!!!!!!!!!!!!!!!
  ...

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

moelski

Hi Roman,

thx for your feedback. I will try that.

Could tell me in 1-2 sentences what´s the main problem here?
Just to learn a little bit  :)

Greetz Dominik

Roman Novgorodov

Hello

We use original engine for multi target notification about changes of nrComm object states. It is like delegates in .NET, but designed more early :-)
In your case, pointer to destroyed nrDeviceBox instance is still used :-(
Shortly, it is bug. We will fix it in the next release. While you can try solution above.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

moelski

Hi Roman,

QuoteShortly, it is bug. We will fix it in the next release.

Thx

QuoteWhile you can try solution above.

Works like a charme  :)