Changeset 1823


Ignore:
Timestamp:
04/22/12 09:06:47 (14 months ago)
Author:
philmoz
Message:

Fix for occasional crash when enabling edge overlay.
Menu module load & unload was happening in two different tasks which sometimes conflicted.

Location:
trunk/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/gui.c

    r1801 r1823  
    20862086 
    20872087//------------------------------------------------------------------- 
     2088// Flag to tell SpyTask to unload GUI menu modules 
     2089static int unload_gui_modules = 0; 
     2090 
     2091// Unload GUI menu modules in SpyTask 
     2092void gui_kbd_unload_modules() 
     2093{ 
     2094    if (unload_gui_modules) 
     2095    { 
     2096        // Unload all modules which are marked as safe to unload, or loaded for menus 
     2097        gui_menu_unload_module_menus(); 
     2098        module_async_unload_allrunned(0); 
     2099        unload_gui_modules = 0; 
     2100    } 
     2101} 
     2102 
    20882103void gui_kbd_leave() 
    20892104{ 
     
    21002115    gui_set_mode(&defaultGuiHandler); 
    21012116 
    2102         // Unload all modules which are marked as safe to unload, or loaded for menus 
    2103     gui_menu_unload_module_menus(); 
    2104         module_async_unload_allrunned(0); 
     2117    // This is called from the keyboard task 
     2118    // Flag any modules loaded via menus or gui to be unloaded in SpyTask 
     2119    // Unloading them here can lead to conflicts and crashes 
     2120    unload_gui_modules = 1; 
    21052121 
    21062122        conf_update_prevent_shutdown(); 
  • trunk/core/main.c

    r1719 r1823  
    241241 
    242242#ifdef OPT_SCRIPTING 
    243     if (conf.script_startup==1) script_autostart();                             // remote autostart 
     243    if (conf.script_startup==1) script_autostart();             // remote autostart 
    244244    if (conf.script_startup==2) { 
    245245        conf.script_startup=0; 
     
    249249#endif 
    250250 
    251     while (1){ 
     251    while (1) 
     252    { 
    252253 
    253254#ifdef  CAM_LOAD_CUSTOM_COLORS 
     
    255256#endif 
    256257 
    257         if (raw_data_available) { 
     258        if (raw_data_available) 
     259        { 
    258260            raw_need_postprocess = raw_savefile(); 
    259261            hook_raw_save_complete(); 
     
    271273        } 
    272274 
     275        // Unload any GUI menu modules 
     276        extern void gui_kbd_unload_modules(); 
     277        gui_kbd_unload_modules(); 
     278 
    273279        if (state_shooting_progress != SHOOTING_PROGRESS_PROCESSING) 
    274280        { 
     
    277283 
    278284#ifdef OPT_EDGEOVERLAY 
    279             if(((gui_get_mode()==GUI_MODE_NONE) || (gui_get_mode()==GUI_MODE_ALT)) && conf.edge_overlay_thresh && conf.edge_overlay_enable) { 
    280  
    281                                 // We need to skip first tick because stability 
    282                                 static int skip_counter=1; 
    283                                  
    284                                 if (skip_counter>0) { 
    285                                         skip_counter--; 
    286                                 } 
    287                                 else if (module_edgeovr_load()) { 
    288                                         libedgeovr->edge_overlay(); 
    289                                 } 
    290                         } 
     285            if(((gui_get_mode()==GUI_MODE_NONE) || (gui_get_mode()==GUI_MODE_ALT)) && conf.edge_overlay_thresh && conf.edge_overlay_enable) 
     286            { 
     287                // We need to skip first tick because stability 
     288                static int skip_counter=1; 
     289 
     290                if (skip_counter>0) 
     291                { 
     292                    skip_counter--; 
     293                } 
     294                else if (module_edgeovr_load()) 
     295                { 
     296                    libedgeovr->edge_overlay(); 
     297                } 
     298            } 
    291299#endif 
    292300        } 
    293301 
    294         if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) { 
     302        if ((state_shooting_progress == SHOOTING_PROGRESS_PROCESSING) && (!shooting_in_progress())) 
     303        { 
    295304            state_shooting_progress = SHOOTING_PROGRESS_DONE; 
    296305            if (raw_need_postprocess) raw_postprocess(); 
     
    303312#endif 
    304313 
    305                 // Process async module unload requests 
    306                 module_tick_unloader(); 
     314        // Process async module unload requests 
     315        module_tick_unloader(); 
    307316 
    308317        msleep(20); 
    309                 chdk_started_flag=1; 
     318        chdk_started_flag=1; 
    310319    } 
    311320} 
Note: See TracChangeset for help on using the changeset viewer.