|
 |
asp_components thread: Data Overwrite when call VB COM object (STA: singlethreaded apartment)
Message #1 by "licia liu" <penglicia@y...> on Mon, 5 Nov 2001 18:01:10
|
|
Call a VB COM object (STA: singlethreaded apartment). There are two asp
pages. Inside 1.asp create an instance of the COM object MyObj1. Inside
2.asp create an instance of the COM object MyObj2 too. Pop up two browsers
at IE 5.0. Open 1.asp at browser1, then 2.asp at browser2. Since 2.asp was
opened after 1.asp, the object MyObj2 inside 2.asp was created after the
1.asp's MyObj1. The data of the MyObj1 got overwritten by MyObj2's.
Test the same thing in one VB project,there are two forms. Inside Form1
create an instance of the COM object. Inside Form2 also crate an instance
of the COM object. Since the instance of the COM object inside Form2 is
created after the Form1's, the object inside the form2's overwrite the
data of the object1 inside form1's data.
object1 = server.createobject("BB.clsObject") /** in 1.asp or form1 **/
object2 = server.createobject("BB.clsObject") /** in 2.asp or form2 **/
Should this case happen when I call an instance of COM object (VB COM
object, STA:singlethreaded apartment) ?
Thanks for your help !
licia
Message #2 by "Lewis, James" <James.Lewis@i...> on Mon, 5 Nov 2001 14:47:21 -0700
|
|
This is atypical behavior for a COM control, and the marshalling (apartment
or free threaded) has nothing inherently to do with sharing of data between
instances. The type of behavior you are witnessing describes what is
referred to as a COM Singleton, a special type of COM control specifically
written to share data between instances of itself. Writing singletons is
actually pretty hard to do properly so I'm curious if the control was
written poorly (improper use of global data). Anyway, a likely way to cheat
yourself out of this problem is to defeat the control's sharing behavior by
wrapping it in an MTX package. Still that's a hack, and examination of how
this control was written would be a good idea.
-----Original Message-----
From: licia liu [mailto:penglicia@y...]
Sent: Monday, November 05, 2001 11:01 AM
To: ASP components
Subject: [asp_components] Data Overwrite when call VB COM object (STA:
singlethreaded apartment)
Call a VB COM object (STA: singlethreaded apartment). There are two asp
pages. Inside 1.asp create an instance of the COM object MyObj1. Inside
2.asp create an instance of the COM object MyObj2 too. Pop up two browsers
at IE 5.0. Open 1.asp at browser1, then 2.asp at browser2. Since 2.asp was
opened after 1.asp, the object MyObj2 inside 2.asp was created after the
1.asp's MyObj1. The data of the MyObj1 got overwritten by MyObj2's.
Test the same thing in one VB project,there are two forms. Inside Form1
create an instance of the COM object. Inside Form2 also crate an instance
of the COM object. Since the instance of the COM object inside Form2 is
created after the Form1's, the object inside the form2's overwrite the
data of the object1 inside form1's data.
object1 = server.createobject("BB.clsObject") /** in 1.asp or form1 **/
object2 = server.createobject("BB.clsObject") /** in 2.asp or form2 **/
Should this case happen when I call an instance of COM object (VB COM
object, STA:singlethreaded apartment) ?
Thanks for your help !
licia
$subst('Email.Unsub')
Message #3 by Oleg Kapeljushnik <c-oleg.kapeljushnik@w...> on Mon, 05 Nov 2001 15:46:32 -0500
|
|
Hi !
It seems like some code error.
We had similar error in VC ATL component but it turns out that it was
some code problem.
Check this option and if you don't find anything
can you specify what data is overwritten like some variable or file(s).
Oleg
-----Original Message-----
From: licia liu [mailto:penglicia@y...]
Sent: November 05, 2001 6:01 PM
To: ASP components
Subject: [asp_components] Data Overwrite when call VB COM object (STA:
singlethreaded apartment)
Call a VB COM object (STA: singlethreaded apartment). There are two asp
pages. Inside 1.asp create an instance of the COM object MyObj1. Inside
2.asp create an instance of the COM object MyObj2 too. Pop up two browsers
at IE 5.0. Open 1.asp at browser1, then 2.asp at browser2. Since 2.asp was
opened after 1.asp, the object MyObj2 inside 2.asp was created after the
1.asp's MyObj1. The data of the MyObj1 got overwritten by MyObj2's.
Test the same thing in one VB project,there are two forms. Inside Form1
create an instance of the COM object. Inside Form2 also crate an instance
of the COM object. Since the instance of the COM object inside Form2 is
created after the Form1's, the object inside the form2's overwrite the
data of the object1 inside form1's data.
object1 = server.createobject("BB.clsObject") /** in 1.asp or form1 **/
object2 = server.createobject("BB.clsObject") /** in 2.asp or form2 **/
Should this case happen when I call an instance of COM object (VB COM
object, STA:singlethreaded apartment) ?
Thanks for your help !
licia
c-oleg.kapeljushnik@w...
$subst('Email.Unsub')
|
|
 |