https://bz.apache.org/ooo/show_bug.cgi?id=128589

          Issue ID: 128589
        Issue Type: DEFECT
           Summary: Crash if use EnumableMap put method embed in a
                    function
           Product: App Dev
           Version: 4.1.15
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: Normal
          Priority: P5 (lowest)
         Component: api
          Assignee: issues@openoffice.apache.org
          Reporter: ooofo...@free.fr
  Target Milestone: ---

This code works:
Sub Main
        oVar = com.sun.star.container.EnumerableMap.create("string", "string")
        oVar.put("Foo","")
        oVar.put("Bar","")
End Sub

So now, I create 2 functions to embed .put method and check if key exists
Warning, this code crashed AOO:
Sub Main
        oVar = com.sun.star.container.EnumerableMap.create("string", "string")
        EnumAddKey(oVar, "Foo")
        EnumAddKey(oVar, "Bar")
End Sub

Function EnumAddKey(oTmp, sTmp)
        if EnumCheckKey(oTmp, sTmp) then 
                msgbox "Key already exists: " & sTmp
                exit function
        endif
        oTmp.put(sTmp, "")
        EnumAddKey = oTmp
End function

Function EnumCheckKey(oTmp, sTmp)
        sRet = false
        oEnum = oTmp.createKeyEnumeration(False)
        Do While oEnum.hasMoreElements
                sItem = oEnum.nextElement
                if sTmp = sItem then sRet = true : exit do
        Loop
        EnumCheckKey = sRet
End function


It failed on second EnumAddKey function call in oTmp.put line for no reason

Tested on Debian and Win10 with same (bad) result.

-- 
You are receiving this mail because:
You are the assignee for the issue.

Reply via email to