Changeset 2405

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

Protect access to some plugin env structure members with a mutex

Files:

Legend:

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

    r2404 r2405  
    219219        OSyncError *error = NULL; 
    220220 
     221        g_mutex_lock(env->plugin_env->plugin_mutex); 
     222         
    221223        if(!env->plugin_env->connected) { 
    222224                /* We only want to connect once per session */ 
    223                 if (!_connectDevice(env->plugin_env, &error)) 
     225                if (!_connectDevice(env->plugin_env, &error)) { 
     226                        g_mutex_unlock(env->plugin_env->plugin_mutex); 
    224227                        goto error; 
     228                } 
    225229                env->plugin_env->connected = TRUE; 
    226230        } 
     
    230234                opie_fetch_file(env->plugin_env, OPIE_OBJECT_TYPE_CATEGORY, OPIE_CATEGORY_FILE, &env->plugin_env->categories_doc, NULL); 
    231235        } 
     236         
     237        g_mutex_unlock(env->plugin_env->plugin_mutex); 
    232238         
    233239        /* pull the required data back */ 
     
    611617         
    612618        env->backuppath = NULL; 
     619        env->plugin_mutex = g_mutex_new(); 
    613620         
    614621        /* Contacts sink */ 
     
    670677        g_free(env->uidmap_file); 
    671678         
     679        g_mutex_free(env->plugin_mutex); 
     680         
    672681        g_free(env->contact_env); 
     682        g_free(env->todo_env); 
     683        g_free(env->event_env); 
     684        g_free(env->note_env); 
    673685        g_free(env); 
    674686         
  • plugins/opie-sync/src/opie_sync.h

    r2115 r2405  
    8282        GTree*            uidmap; 
    8383        char*             uidmap_file; 
     84         
     85        GMutex*           plugin_mutex; 
    8486}; 
    8587