• MorphOS Developer
    itix
    Posts: 1516 from 2003/2/24
    From: Finland
    Quote:

    ciVic wrote:
    Hi all,

    to keep it short, this crashes my app immediately after I close the request:

    app = ApplicationObject,End;
    fr = (struct FileRequester *)MUI_AllocAslRequest(ASL_FileRequest, frtags);
    MUI_AslRequest(fr, NULL);


    And this works:


    fr = (struct FileRequester *)MUI_AllocAslRequest(ASL_FileRequest, frtags);
    MUI_AslRequest(fr, NULL);
    app = ApplicationObject,End;


    This is only a short example. I have a fully running app where I'm not able to show a requester trying many examples. I also tried AllocAslRequest and AslRequest, same result.

    MorphOS 3.8 on PowerBook 5,9. Thx!


    Uhm, I am certain it works. See here:

    Quote:


    int SaveWindowBuffer(const char *filename)
    {
    int retval;

    if (filename)
    {
    retval = SaveBuffer(filename);
    }
    else
    {
    struct FileRequester *req;
    static struct TagItem tags[] =
    {
    { ASLFR_TitleText , 0 },
    { ASLFR_DoPatterns , TRUE },
    { ASLFR_DoSaveMode , TRUE },
    { ASLFR_InitialDrawer , (IPTR)(CONST_STRPTR)"RAM:" },
    { ASLFR_InitialFile , (IPTR)(CONST_STRPTR)"Snoopium.log" },
    { ASLFR_InitialPattern, (IPTR)(CONST_STRPTR)"#?.log" },
    { TAG_DONE, 0 }
    };

    req = SaveLogReq;

    if (!req)
    {
    tags[0].ti_Data = (ULONG)MSG(MSG_ASL_SAVEBUFFER);
    SaveLogReq = req = (struct FileRequester *)MUI_AllocAslRequest(ASL_FileRequest, (struct TagItem *)tags);
    }

    retval = 0;

    if (req)
    {
    if (MUI_AslRequest(req, NULL))
    {
    BPTR lock;

    lock = Lock(req->rf_Dir, ACCESS_READ);

    filename = req->rf_File;

    if (lock)
    {
    lock = CurrentDir(lock);
    retval = SaveBuffer(filename);

    UnLock(CurrentDir(lock));
    }
    }
    }
    }

    if (!retval && filename)
    ShowError(MSG(MSG_ERROR_SAVING_BUFFER), (ULONG)filename);

    return retval;
    }



    http://snoopium.cvs.sourceforge.net/viewvc/snoopium/Snoopium/mainwin.c?revision=1.30&view=markup
    1 + 1 = 3 with very large values of 1
  • »14.06.15 - 22:43
    Profile