Revision 8baa1fe6
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedAttachDaemon.java | ||
---|---|---|
83 | 83 |
return ( num>0 ); |
84 | 84 |
} |
85 | 85 |
|
86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
87 |
|
|
88 |
static void cancelAttachJobs(DistortedAttacheable a, DistortedEffects e) |
|
89 |
{ |
|
90 |
int num = mJobs.size(); |
|
91 |
Job job; |
|
92 |
|
|
93 |
for(int i=0; i<num; i++) |
|
94 |
{ |
|
95 |
job = mJobs.get(i); |
|
96 |
|
|
97 |
if( job.type == ATTACH && job.attacheable==a ) |
|
98 |
{ |
|
99 |
DistortedEffects effects = job.object.getEffects(); |
|
100 |
|
|
101 |
if( effects.getID() == e.getID() ) |
|
102 |
{ |
|
103 |
mJobs.remove(i); |
|
104 |
break; |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
86 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
87 | 111 |
|
88 | 112 |
static void attach(DistortedAttacheable a, DistortedNode n) |
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
443 | 443 |
{ |
444 | 444 |
long id = effects.getID(); |
445 | 445 |
DistortedNode node; |
446 |
boolean detached= false; |
|
446 | 447 |
|
447 | 448 |
for(int i=0; i<mNumChildren[0]; i++) |
448 | 449 |
{ |
... | ... | |
450 | 451 |
|
451 | 452 |
if( node.mEffects.getID()==id ) |
452 | 453 |
{ |
454 |
detached=true; |
|
453 | 455 |
DistortedAttachDaemon.detach(this,node); |
454 | 456 |
break; |
455 | 457 |
} |
456 | 458 |
} |
459 |
|
|
460 |
if( !detached ) |
|
461 |
{ |
|
462 |
// if we failed to detach any, it still might be the case that |
|
463 |
// there's a job in Daemon's queue that we need to cancel. |
|
464 |
DistortedAttachDaemon.cancelAttachJobs(this,effects); |
|
465 |
} |
|
457 | 466 |
} |
458 | 467 |
|
459 | 468 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
448 | 448 |
{ |
449 | 449 |
long id = effects.getID(); |
450 | 450 |
DistortedNode node; |
451 |
boolean detached = false; |
|
451 | 452 |
|
452 | 453 |
for(int i=0; i<mNumChildren; i++) |
453 | 454 |
{ |
... | ... | |
455 | 456 |
|
456 | 457 |
if( node.getEffects().getID()==id ) |
457 | 458 |
{ |
459 |
detached = true; |
|
458 | 460 |
DistortedAttachDaemon.detach(this,node); |
459 | 461 |
break; |
460 | 462 |
} |
461 | 463 |
} |
464 |
|
|
465 |
if( !detached ) |
|
466 |
{ |
|
467 |
// if we failed to detach any, it still might be the case that |
|
468 |
// there's a job in Daemon's queue that we need to cancel. |
|
469 |
DistortedAttachDaemon.cancelAttachJobs(this,effects); |
|
470 |
} |
|
462 | 471 |
} |
463 | 472 |
|
464 | 473 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
When detaching Nodes, do make sure we also cancel any ATTACH jobs that might be pending.