comparison src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 422:651aff5a46c7

synchronize font size listeners; log get/set field values
author Carl Byington <carl@five-ten-sg.com>
date Thu, 30 Oct 2014 16:27:31 -0700
parents 071eccdff8ea
children
comparison
equal deleted inserted replaced
421:660ac2d2003b 422:651aff5a46c7
457 charHeight = (int)FloatMath.ceil(fm.descent - fm.top); 457 charHeight = (int)FloatMath.ceil(fm.descent - fm.top);
458 458
459 // refresh any bitmap with new font size 459 // refresh any bitmap with new font size
460 if (parent != null) parentChanged(parent); 460 if (parent != null) parentChanged(parent);
461 461
462 for (FontSizeChangedListener ofscl : fontSizeChangedListeners) 462 synchronized(fontSizeChangedListeners) {
463 ofscl.onFontSizeChanged(size); 463 for (FontSizeChangedListener ofscl : fontSizeChangedListeners)
464 ofscl.onFontSizeChanged(size);
465 }
464 466
465 host.setFontSize(size); 467 host.setFontSize(size);
466 manager.hostdb.updateFontSize(host); 468 manager.hostdb.updateFontSize(host);
467 } 469 }
468 470
472 * 474 *
473 * @param listener 475 * @param listener
474 * listener to add 476 * listener to add
475 */ 477 */
476 public void addFontSizeChangedListener(FontSizeChangedListener listener) { 478 public void addFontSizeChangedListener(FontSizeChangedListener listener) {
477 fontSizeChangedListeners.add(listener); 479 synchronized(fontSizeChangedListeners) {
480 fontSizeChangedListeners.add(listener);
481 }
478 } 482 }
479 483
480 /** 484 /**
481 * Remove an {@link FontSizeChangedListener} from the list of listeners for 485 * Remove an {@link FontSizeChangedListener} from the list of listeners for
482 * this bridge. 486 * this bridge.
483 * 487 *
484 * @param listener 488 * @param listener
485 */ 489 */
486 public void removeFontSizeChangedListener(FontSizeChangedListener listener) { 490 public void removeFontSizeChangedListener(FontSizeChangedListener listener) {
487 fontSizeChangedListeners.remove(listener); 491 synchronized(fontSizeChangedListeners) {
492 fontSizeChangedListeners.remove(listener);
493 }
488 } 494 }
489 495
490 /** 496 /**
491 * Something changed in our parent {@link TerminalView}, maybe it's a new 497 * Something changed in our parent {@link TerminalView}, maybe it's a new
492 * parent, or maybe it's an updated font size. We should recalculate 498 * parent, or maybe it's an updated font size. We should recalculate