@@ -68,6 +68,7 @@ public class SloeberProject extends Common {
68
68
private boolean myNeedToPersist = false ; // Do we need to write data to disk
69
69
private boolean myNeedsClean = false ; // is there old sloeber data that needs cleaning
70
70
private boolean myNeedsSyncWithCDT = false ; // Knows CDT all configs Sloeber Knows
71
+ private boolean myIsConfiguring = false ; // True if configuration of the project is ongoing
71
72
72
73
private static final String ENV_KEY_BUILD_SOURCE_PATH = BUILD + DOT + SOURCE + DOT + PATH ;
73
74
private static final String ENV_KEY_BUILD_PATH = BUILD + DOT + PATH ;
@@ -394,47 +395,56 @@ public void configure() {
394
395
*/
395
396
396
397
public synchronized boolean configure (ICProjectDescription prjCDesc , boolean prjDescWritable ) {
398
+ if (myIsConfiguring ) {
399
+ return false ;
400
+ }
397
401
boolean saveProjDesc = false ;
398
- if (isInMemory ) {
399
- if (myIsDirty ) {
400
- createSloeberConfigFiles (prjCDesc );
401
- setAllEnvironmentVars (prjCDesc );
402
402
403
- myIsDirty = false ;
403
+ try {
404
+ myIsConfiguring = true ;
405
+
406
+ if (isInMemory ) {
407
+ if (myIsDirty ) {
408
+ createSloeberConfigFiles (prjCDesc );
409
+ setAllEnvironmentVars (prjCDesc );
410
+ myIsDirty = false ;
411
+ }
412
+ if (myNeedToPersist ) {
413
+ createSloeberConfigFiles (prjCDesc );
414
+ }
415
+ if (prjDescWritable ) {
416
+ if (myNeedsSyncWithCDT ) {
417
+ saveProjDesc = saveProjDesc || syncWithCDT (prjCDesc , prjDescWritable );
418
+ }
419
+ if (myNeedsClean ) {
420
+ myNeedsClean = cleanOldData (prjCDesc );
421
+ saveProjDesc = saveProjDesc || myNeedsClean ;
422
+ }
423
+ }
424
+ return saveProjDesc ;
404
425
}
405
- if (myNeedToPersist ) {
426
+
427
+ // first read the sloeber files in memory
428
+ saveProjDesc = readConfig (prjCDesc , prjDescWritable );
429
+ if (myNeedToPersist || myIsDirty ) {
406
430
createSloeberConfigFiles (prjCDesc );
431
+ myIsDirty = false ;
407
432
}
408
433
if (prjDescWritable ) {
409
- if (myNeedsSyncWithCDT ) {
410
- saveProjDesc = saveProjDesc || syncWithCDT (prjCDesc , prjDescWritable );
411
- }
412
434
if (myNeedsClean ) {
435
+ // we migrated from a previous sloeber configuration
436
+ // and we can safely delete the old data
413
437
myNeedsClean = cleanOldData (prjCDesc );
414
438
saveProjDesc = saveProjDesc || myNeedsClean ;
415
439
}
440
+ if (myNeedsSyncWithCDT ) {
441
+ saveProjDesc = saveProjDesc || syncWithCDT (prjCDesc , prjDescWritable );
442
+ }
416
443
}
417
- return saveProjDesc ;
418
- }
419
-
420
- // first read the sloeber files in memory
421
- saveProjDesc = readConfig (prjCDesc , prjDescWritable );
422
- if (myNeedToPersist || myIsDirty ) {
423
- createSloeberConfigFiles (prjCDesc );
424
- myIsDirty = false ;
425
- }
426
- if (prjDescWritable ) {
427
- if (myNeedsClean ) {
428
- // we migrated from a previous sloeber configuration
429
- // and we can safely delete the old data
430
- myNeedsClean = cleanOldData (prjCDesc );
431
- saveProjDesc = saveProjDesc || myNeedsClean ;
432
- }
433
- if (myNeedsSyncWithCDT ) {
434
- saveProjDesc = saveProjDesc || syncWithCDT (prjCDesc , prjDescWritable );
435
- }
444
+ setAllEnvironmentVars (prjCDesc );
445
+ } finally {
446
+ myIsConfiguring = false ;
436
447
}
437
- setAllEnvironmentVars (prjCDesc );
438
448
return saveProjDesc ;
439
449
}
440
450
@@ -660,7 +670,6 @@ public void run(IProgressMonitor internalMonitor) throws CoreException {
660
670
return runnable .projConfMustBeSaved ;
661
671
}
662
672
663
-
664
673
/**
665
674
* This methods creates/updates 2 files in the workspace. Together these files
666
675
* contain the Sloeber project configuration info The info is split into 2 files
@@ -785,8 +794,6 @@ public void setBoardDescription(String confDescName, BoardDescription boardDescr
785
794
myIsDirty = true ;
786
795
}
787
796
788
-
789
-
790
797
/**
791
798
* get the Arduino project description based on a project description
792
799
*
0 commit comments