Skip to content

Commit 45f434d

Browse files
committed
Only mark config dirty if something changed
1 parent c7cb1ef commit 45f434d

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

core/src/com/biglybt/plugin/net/buddy/BuddyPluginBeta.java

+17-10
Original file line numberDiff line numberDiff line change
@@ -7226,41 +7226,48 @@ public void perform(TimerEvent event) {
72267226

72277227
String key = getPropsKey();
72287228

7229-
Map<String,Object> props = COConfigurationManager.getMapParameter( key, null );
7229+
Map<String,Object> old_props = COConfigurationManager.getMapParameter( key, null );
72307230

7231-
if ( props == null ){
7231+
Map<String,Object> new_props;
7232+
7233+
if ( old_props == null ){
72327234

72337235
if ( value == null ){
72347236

72357237
return;
72367238
}
72377239

7238-
props = new HashMap<>();
7240+
new_props = new HashMap<>();
72397241

72407242
}else{
72417243

7242-
props = BEncoder.cloneMap( props );
7244+
new_props = BEncoder.cloneMap( old_props );
72437245
}
72447246

72457247
if ( value != null ){
72467248

7247-
props.put( name, value );
7249+
new_props.put( name, value );
72487250

72497251
}else{
72507252

7251-
props.remove( name );
7253+
new_props.remove( name );
72527254
}
72537255

7254-
if ( props.isEmpty() ){
7256+
if ( new_props.isEmpty() ){
72557257

72567258
COConfigurationManager.removeParameter( key );
72577259

7260+
COConfigurationManager.setDirty();
7261+
72587262
}else{
72597263

7260-
COConfigurationManager.setParameter( key, props );
7264+
if ( !BEncoder.mapsAreIdentical(old_props, new_props)){
7265+
7266+
COConfigurationManager.setParameter( key, new_props );
7267+
7268+
COConfigurationManager.setDirty();
7269+
}
72617270
}
7262-
7263-
COConfigurationManager.setDirty();
72647271
}
72657272
}
72667273

0 commit comments

Comments
 (0)