comparison qt/d2/qt/Signal.d @ 268:cf6a4cd0e3f2

fix for #35
author eldar
date Sun, 20 Sep 2009 09:11:51 +0000
parents 073b9153ed8a
children 501128ac7a2c
comparison
equal deleted inserted replaced
267:1124c49b9d58 268:cf6a4cd0e3f2
428 428
429 static const slotListCount = slotLists.tupleof.length; 429 static const slotListCount = slotLists.tupleof.length;
430 } 430 }
431 431
432 432
433 private ThreadLocal!(Object) signalSender_; 433 private Object signalSender_;
434 static this()
435 {
436 signalSender_ = new ThreadLocal!(Object);
437 }
438 434
439 /** 435 /**
440 If called from a slot, returns the object 436 If called from a slot, returns the object
441 that is emitting the signal. Otherwise, returns null. 437 that is emitting the signal. Otherwise, returns null.
442 */ 438 */
443 public Object signalSender() { 439 public Object signalSender() {
444 return signalSender_.val; 440 return signalSender_;
445 } 441 }
446 442
447 public class SignalHandler 443 public class SignalHandler
448 { 444 {
449 SignalConnections[] connections; 445 SignalConnections[] connections;
600 596
601 if (cons.hasSlots) 597 if (cons.hasSlots)
602 { 598 {
603 { 599 {
604 cons.isInUse = true; 600 cons.isInUse = true;
605 signalSender_.val = owner; 601 signalSender_ = owner;
606 scope(exit) 602 scope(exit)
607 { 603 {
608 cons.isInUse = false; 604 cons.isInUse = false;
609 signalSender_.val = null; 605 signalSender_ = null;
610 } 606 }
611 607
612 // Store the lengths to avoid calling new slots 608 // Store the lengths to avoid calling new slots
613 // connected in the slots being called. 609 // connected in the slots being called.
614 // dmd bug: int[cons.slotListCount] fails 610 // dmd bug: int[cons.slotListCount] fails