[Bug 33239] New: VisualBasic arrays of User Defined Type (UDTs) with strings
wine-bugs at winehq.org
wine-bugs at winehq.org
Mon Mar 18 06:08:58 CDT 2013
http://bugs.winehq.org/show_bug.cgi?id=33239
Bug #: 33239
Summary: VisualBasic arrays of User Defined Type (UDTs) with
strings
Product: Wine
Version: unspecified
Platform: x86
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: -unknown
AssignedTo: wine-bugs at winehq.org
ReportedBy: mod at navsoft.com
Classification: Unclassified
Created attachment 43964
--> http://bugs.winehq.org/attachment.cgi?id=43964
Uses a simple program to test where the crash occurs
I use arrays of UDTs which work under MS Windows. (Any version post Win 2000
except ME.) The program also works happily on a Mac using a Parallels virtual
machine.
These fail under WINE if one or more of the fields is a string. The "TYPE"
order makes no difference.
UDTs which contain only numbers are not affected.
Failure occurs on any attempt to "ReDim" or "Erase" the array. The problem does
not occur when the strings are fixed length or for flat UDTs containing strings
of undeclared length. Prior to a crash, the content of the UDTs can be read and
written to.
Trying to write a simple program produces strange results. I tried initially on
an old PC and found that it would crash simply by redimming the arrays but when
installed under Parallels, it will handle simple arrays and only crashes as I
start to get more adventurous; i.e. using a UDT type declared in a DLL but
otherwise identical.
My main program can be downloaded at http://navsoft.com/AstroNav_Setup.exe. It
makes no claims to being compatible with WINE but there are references to the
problem area elsewhere in this forum by Users who would like to run it under
WINE.
AstroNav uses UDTs extensively. The problem is the Almanac screen where multi
dimension UDTs are widely used. With AstroNav, simply declaring and then
destroying the arrays will cause a crash. [There is also a problem with WINE's
treatment of SetGraphicsMode which I have not yet pinned down but will
hopefully circumvent very shortly. (The SetGraphicsMode API does not work quite
as Microsoft claim so removing it, is probably desirable.)]
The attached backtrace was caused by the following code. The crash occurs only
for Command4_Click() and only on the third press. (Rapid pressing will cause a
"The array is temporarily locked" error/ crash.)
FORM CODE
==========
Private Type My_UDT
n1 As Long
s1 As String
s2 As String
End Type
Private mUDT() As My_UDT
Private DLL_UDT() As Main_Almanac_Columns
Private Sub Command1_Click() ' NO PROBLEM NOW BUT SIMILAR CODE CAUSED A
Dim i As Long ' CRASH ON AN OLDER PC
ReDim mUDT(99)
For i = 0 To 99
mUDT(i).s1 = "Some String"
mUDT(i).s2 = "Some String"
Next i
ReDim mUDT(99)
End Sub
Private Sub Command2_Click() ' SAME AS ABOVE BUT USING A GLOBAL UDT
Dim i As Long ' = A BIT MORE ADVENTUROUS
ReDim gUDT(99)
For i = 0 To 99
gUDT(i).s1 = "Some String"
gUDT(i).s2 = "Some String"
Next i
ReDim gUDT(99)
End Sub
Private Sub Command3_Click() ' MORE ADVENTUROUS; PASSING DATA USING
Compile_Data ' Public Property Get
gUDT = My_Module_UDT
End Sub
Private Sub Command4_Click() ' CRASHES ON THE THIRD CLICK ON MY MAIN
Alt_Compile_Data ' MACHINE
DLL_UDT = My_DLL_UDT
End Sub
MODULE CODE
===========
Private DLL_UDT() As Main_Almanac_Columns
Type Module_UDT
n1 As Long
s1 As String
s2 As String
End Type
Private mUDT() As Module_UDT
Public gUDT() As Module_UDT
'\\ THE MODULE LEVEL TEST
Sub Compile_Data()
Dim i As Long
ReDim mUDT(71)
For i = 0 To 71
With mUDT(i)
.n1 = i
.s1 = i
.s2 = i
End With
Next i
End Sub
Public Property Get My_Module_UDT() As Module_UDT()
My_Module_UDT = mUDT
End Property
'\\ USING THE IDENTICAL TYPE DECLARED IN A MODULE
Sub Alt_Compile_Data()
Dim i As Long
ReDim DLL_UDT(71)
For i = 0 To 71
With DLL_UDT(i)
.Gap = i
.sGHA = i
.sDec = i
End With
Next i
End Sub
Public Property Get My_DLL_UDT() As Main_Almanac_Columns()
My_DLL_UDT = DLL_UDT
End Property
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the wine-bugs
mailing list