incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 119935] New: private:stream - load component from ByteArray crashes aoo34
Date Sat, 09 Jun 2012 14:13:04 GMT

          Priority: P3
            Bug ID: 119935
           Summary: private:stream - load component from ByteArray crashes
          Severity: critical
        Issue Type: DEFECT
    Classification: Code
                OS: Windows, all
          Hardware: PC
            Status: CONFIRMED
           Version: AOO 3.4.0
         Component: scripting
           Product: framework

playing with the macro below i noticed aoo3.4 (and oo3.3, lo 3.5.4) will crash
suddenly while oo 3.2 works fine:

steps to reproduce:
- run macro "Test_loadComponentFromByteArray"
- close new document (sometomes you have to run twice,
  or close another open document)
- crash 

'by ms777
'demonstrates loading a document from byte array
'we start with a simple one: a byte array, every second byte is a tab char

Sub Test_loadComponentFromByteArray
    aProps = CreateDefaultMediaDescriptor()
    aBytes = Array(72,9,69,9,76,9,76,9,79)
    oTmpDoc = loadComponentFromByteArray(aBytes, "_default", 0, aProps)
End Sub

Function loadComponentFromByteArray(aBytes as Any, sFrameName as String,
lSearchFlags as Long, aPropsT as Object) as Object

    'create a temporary storage
    oStorageFac = createUnoService("")
    oStorage    = oStorageFac.createInstance()
    oStream     = oStorage.openStreamElement("ms777",

    'now write the byte array to the stream

    'open the stream again, now for seekable reading
    oStream = oStorage.openStreamElement("ms777",

    aProps = AddInputStreamToMediaDescriptor(oStream, aPropsT) ' func name says
all ...
    'now load it
    loadComponentFromByteArray =
StarDesktop.loadComponentFromURL("private:stream", "_default", 0, aProps)
End Function

'two little helpers for both examples
Function CreateDefaultMediaDescriptor() as Object
    Dim aProps(1) as new
    aProps(0).Name = "FilterOptions"
    aProps(0).Value = ""
    aProps(0).Value = "9,0,0,1" 'tab separated
    aProps(1).Name = "FilterName"
    aProps(1).Value = "Text - txt - csv (StarCalc)"
    CreateDefaultMediaDescriptor = aProps()
End Function

Function AddInputStreamToMediaDescriptor(oStream as Object, aPropsT as Object)
as Object
    'copy the MediaDescriptor, add the InputStream
    lUBound = UBound(aPropsT)
    Dim aProps(lUBound+1) as new
    For k=0 to lUBound
        aProps(k).Name  = aPropsT(k).Name
        aProps(k).Value = aPropsT(k).Value
    Next k
    aProps(lUBound+1).Name = "InputStream"
    aProps(lUBound+1).Value = oStream
    AddInputStreamToMediaDescriptor = aProps()
End Function

You are receiving this mail because:
You are the assignee for the bug.

View raw message