Ticket #1500: background_fix_assert.diff

File background_fix_assert.diff, 2.9 KB (added by IMDagger, 12 years ago)

Fix for "assert trouble" when file is replaced

  • src/file.c

    diff --git a/src/file.c b/src/file.c
    index de3d600..d53b6c2 100644
    a b panel_operate_generate_prompt (const WPanel *panel, const int operation, 
    17681768    return g_strdup (format_string); 
    17691769} 
    17701770 
     1771#ifdef WITH_BACKGROUND 
     1772int file_op_context_destroy_bg_wrap (FileOpContext *ctx) { 
     1773    file_op_context_destroy(ctx); 
     1774    return 0; 
     1775} 
     1776#endif 
     1777 
    17711778/** 
    17721779 * panel_operate: 
    17731780 * 
    panel_operate (void *source_panel, FileOperation operation, 
    19111918        } 
    19121919    } 
    19131920 
     1921    /* Background also need ctx->ui, but not full */ 
     1922    if (do_bg) 
     1923        file_op_context_create_ui_without_init (ctx, 1); 
     1924    else 
     1925        file_op_context_create_ui (ctx, 1); 
     1926 
    19141927#ifdef WITH_BACKGROUND 
    19151928    /* Did the user select to do a background operation? */ 
    19161929    if (do_bg) { 
    panel_operate (void *source_panel, FileOperation operation, 
    19491962 
    19501963    /* Now, let's do the job */ 
    19511964 
    1952     if (do_bg) 
    1953         ctx->ui = NULL; 
    1954     else 
    1955         file_op_context_create_ui (ctx, 1); 
    1956  
    19571965    /* This code is only called by the tree and panel code */ 
    19581966    if (single_entry) { 
    19591967        /* We now have ETA in all cases */ 
    panel_operate (void *source_panel, FileOperation operation, 
    21812189#ifdef WITH_BACKGROUND 
    21822190    /* Let our parent know we are saying bye bye */ 
    21832191    if (we_are_background) { 
     2192        parent_call ((void *) file_op_context_destroy_bg_wrap, ctx, 0); 
    21842193        vfs_shut (); 
    21852194        _exit (0); 
    21862195    } 
  • src/filegui.c

    diff --git a/src/filegui.c b/src/filegui.c
    index 340e12a..e9a31cf 100644
    a b check_progress_buttons (FileOpContext *ctx) 
    222222/* {{{ File progress display routines */ 
    223223 
    224224void 
    225 file_op_context_create_ui (FileOpContext *ctx, int with_eta) 
     225file_op_context_create_ui_without_init (FileOpContext *ctx, int with_eta) 
    226226{ 
    227227    FileOpContextUI *ui; 
    228228    int x_size; 
    file_op_context_create_ui (FileOpContext *ctx, int with_eta) 
    293293                label_new (3, FCOPY_GAUGE_X, sixty)); 
    294294    add_widget (ui->op_dlg, ui->file_label[0] = 
    295295                label_new (3, FCOPY_LABEL_X, fifteen)); 
     296} 
     297 
     298void 
     299file_op_context_create_ui (FileOpContext *ctx, int with_eta) 
     300{ 
     301    FileOpContextUI *ui; 
     302 
     303    g_return_if_fail (ctx != NULL); 
     304    g_return_if_fail (ctx->ui == NULL); 
     305 
     306    file_op_context_create_ui_without_init(ctx, with_eta); 
     307    ui = ctx->ui; 
    296308 
    297309    /* We will manage the dialog without any help, that's why 
    298310       we have to call init_dlg */ 
  • src/fileopctx.h

    diff --git a/src/fileopctx.h b/src/fileopctx.h
    index 4943e28..305fe63 100644
    a b enum OperationMode { 
    144144/* The following functions are implemented separately by each port */ 
    145145 
    146146void file_op_context_create_ui (FileOpContext *ctx, int with_eta); 
     147void file_op_context_create_ui_without_init (FileOpContext *ctx, int with_eta); 
    147148void file_op_context_destroy_ui (FileOpContext *ctx); 
    148149 
    149150FileProgressStatus file_progress_show (FileOpContext *ctx, off_t done, off_t total);