https://bugs.freedesktop.org/show_bug.cgi?id=78209

--- Comment #4 from Ewald Anderl <[email protected]> ---
I was request to provide a simple reproducable test case as an exampe for a
related problem. I have proactively done the same for this bug report. I have
also updated the associated document which was streamlined.

Problem description:
====================
After making a call to setDisplayDirectory(), the call to 
getDisplayDirectory() should return the new directory value. If the “get...”
call is made too quickly, the correct value is not returned. It is possible
that other similar race conditions exist. Given the behavior, it is possible
that this is also related to bug 43021.

How to reproduce the problem:
=============================
1. In  LibreOffice, open Tools --> Options; in the LibreOffice – General tab
ensure that “Use LibreOffice dialogs” is unchecked.

2. In LibreOffice, open Tools --> Macros --> Organize Macros --> pick any
module to edit

3. Type (or cut/paste) the following program in to the empty “Sub” of your
choice (Main will do):

    Dim oDialog        'FilePicker dialog
    Dim vBefore        'value before call to setDisplayDirectory
    Dim vAfter        'value after call.
    Dim s            'tmp string for creatint output    
    oDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
    Print "setDisplayDirectory --> /tmp"    'pick any reasonable directory.
    vBefore = oDialog.getDisplayDirectory()    'Before
    oDialog.setDisplayDirectory(ConvertToURL("/tmp"))
REM    Wait 500                                'This line makes it work
    vAfter  = oDialog.getDisplayDirectory()    'After
    s = s & "getDisplayDirectory before = [" & vBefore & "] " & Chr$(10)
    s = s & "getDisplayDirectory after  = [" & vAfter & "]  " & Chr$(10)
    MsgBox s, 0

4. Run this Macro, getDisplayDirectory() fails

5. Edit the Macro to remove the 'REM' in front of the 'Wait” statement

6. Run the Macro again, getDisplayDirectory() works correctly

Current behavior:
=================
Without the “Wait” statement,  getDisplayDirectory() returns an empty string.
With the “Wait” statement,  getDisplayDirectory() returns the correct directory
(“file:///tmp”).

Using the Libreoffice dialog style appears to work correctly.

Expected behavior:
==================
With or without a wait (or code) following the call to  setDisplayDirectory(), 
getDisplayDirectory() should return (“file:///tmp”).

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to