Changeset 2464

Show
Ignore:
Timestamp:
08/17/07 17:47:05 (1 year ago)
Author:
paule
Message:

Fix false modifications triggered because of hash being calculated at the wrong time; protect access to categories using mutex

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/opie-sync/src/opie_sync.c

    r2462 r2464  
    293293        while(item_node) 
    294294        { 
     295                char *uid = opie_xml_get_tagged_uid(item_node); 
     296                unsigned char *hash = hash_xml_node(env->doc, item_node); 
     297                 
    295298                /* Convert category IDs to names that other systems can use */ 
     299                g_mutex_lock(env->plugin_env->plugin_mutex); 
    296300                char *categories_bkup = opie_xml_get_categories(item_node); 
    297301                if(env->plugin_env->categories_doc && categories_bkup) 
    298302                        opie_xml_category_ids_to_names(env->plugin_env->categories_doc, item_node); 
    299                  
    300                 char *uid = opie_xml_get_tagged_uid(item_node); 
     303                g_mutex_unlock(env->plugin_env->plugin_mutex); 
     304                 
    301305                char *data = xml_node_to_text(env->doc, item_node); 
    302                 unsigned char *hash = hash_xml_node(env->doc, item_node); 
    303306 
    304307                /* Restore old categories value as we don't want to save this back to our XML file */ 
     
    434437                                opie_uid = opie_xml_set_ext_uid(change_node, env->doc, env->listelement, env->itemelement, ext_uid); 
    435438                         
    436                         /* Convert categories into names that other systems can use */ 
     439                        /* Convert category names to category IDs that Opie can use */ 
     440                        g_mutex_lock(env->plugin_env->plugin_mutex); 
    437441                        if(env->plugin_env->categories_doc) 
    438442                                opie_xml_category_names_to_ids(env->plugin_env->categories_doc, change_node); 
     443                        g_mutex_unlock(env->plugin_env->plugin_mutex); 
    439444                         
    440445                        /* Get hash */