Menu

DjVuDocEditor::save_as() locks files

2010-03-18
2012-11-08
  • Charles Hyder

    Charles Hyder - 2010-03-18

    Dear developers,

    I've just started playing with djvulibre. I modified code from djvm.cpp which
    concatenates files as follows:

    void Create(const char* result, vector<const char*> files)
    {
           GP<DjVuDocEditor> doc=DjVuDocEditor::create_wait();
           GList<GURL> list;
           for(int i=0;i<files.size();i++)
              list.append(GURL::Filename::UTF8(GNativeString(files[i])));
           doc->insert_group(list);
           doc->save_as(GURL::Filename::UTF8(GNativeString(result)), true);
    }
    

    After I run it the result seems fine. However, if I, for example, try to
    delete the original files pointed to by files_ (the files themselves, that
    is) I run into them being locked. What needs to be done to unlock them?_

     
  • Charles Hyder

    Charles Hyder - 2010-03-18

    When I said "delete" I meant "inside the code, right after calling the above
    function". Of course, after the program that uses this function finishes, all
    the locks are removed. That's why there was no problem with djvm.exe, it never
    does anything with the files it uses for concatenation after the concatenation
    is done.

     
  • Leon Bottou

    Leon Bottou - 2010-03-18

    Try calling DataPool::close_all() before removing…
    - L.

     
  • Charles Hyder

    Charles Hyder - 2010-03-26

    Thanks! I haven't yet had time to continue working on this. But I'll write
    the results when I do.

     
  • Oessi

    Oessi - 2010-09-10

    If DataPool::close_all() not work, try calling

    doc->get_init_data_pool()->clear_stream(true);
    
     

Log in to post a comment.