[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ProbeDisplay Notification Fix
From: |
glen e. p. ropella |
Subject: |
ProbeDisplay Notification Fix |
Date: |
Fri, 21 Mar 1997 08:02:25 -0700 |
Ok. I've fixed the probedisplay notification bug in the typical
Republican way, by throwing code at it. It's messy; but, it works.
Here's a patch file. Save it off to $(SWARMHOME)/src, then go into
$(SWARMHOME)/src and do a:
% patch < probe-notif-patch
Let me know if anything else is wrong.
glen
------------probe-notif-patch-----cut-here----------------------
diff -ru ../../swarm-1.0.1/src/simtools/CompleteProbeDisplay.h
simtools/CompleteProbeDisplay.h
--- ../../swarm-1.0.1/src/simtools/CompleteProbeDisplay.h Fri Feb 28
12:40:28 1997
+++ simtools/CompleteProbeDisplay.h Fri Mar 21 07:28:57 1997
@@ -16,6 +16,7 @@
Frame *topFrame ;
id widgets, topLevel;
ref_t objectRef;
+ BOOL removeRef;
}
-setProbedObject: anObject;
@@ -23,4 +24,9 @@
-getProbedObject;
-update;
+
+-(void) setRemoveRef: (BOOL) torf;
+-(void) setObjectRef: (ref_t) or;
+-(void) drop;
+
@end
diff -ru ../../swarm-1.0.1/src/simtools/CompleteProbeDisplay.m
simtools/CompleteProbeDisplay.m
--- ../../swarm-1.0.1/src/simtools/CompleteProbeDisplay.m Tue Oct 1
21:30:35 1996
+++ simtools/CompleteProbeDisplay.m Fri Mar 21 07:30:07 1997
@@ -204,6 +204,15 @@
return self;
}
+-(void) setRemoveRef: (BOOL) torf {
+ (void) fprintf(stdout, "setting removeRef to %d\n",torf);
+ removeRef = torf;
+}
+
+-(void) setObjectRef: (ref_t) or {
+ objectRef = or;
+}
+
-(void)drop {
id index ;
@@ -225,6 +234,8 @@
[probeDisplayManager removeProbeDisplay: self];
+ if (removeRef) [probedObject removeRef: objectRef];
+
[super drop] ;
}
@end
diff -ru ../../swarm-1.0.1/src/simtools/ProbeDisplay.h simtools/ProbeDisplay.h
--- ../../swarm-1.0.1/src/simtools/ProbeDisplay.h Fri Feb 28 12:40:31 1997
+++ simtools/ProbeDisplay.h Fri Mar 21 07:13:03 1997
@@ -9,7 +9,6 @@
@interface ProbeDisplay : SwarmObject {
id probedObject;
ProbeMap * probeMap;
- ref_t objectRef;
}
-setProbedObject: anObject;
diff -ru ../../swarm-1.0.1/src/simtools/ProbeDisplay.m simtools/ProbeDisplay.m
--- ../../swarm-1.0.1/src/simtools/ProbeDisplay.m Fri Feb 28 12:40:32 1997
+++ simtools/ProbeDisplay.m Fri Mar 21 07:37:51 1997
@@ -51,6 +51,9 @@
//
static void notifyObjectDropped ( id anObject, id realloc, id pd)
{
+ // Put a hook here so that the drop method knows whether the drop
+ // was called from here.
+ [pd setRemoveRef: 0]; // false => don't remove the reference in "drop"
[pd drop];
// There might be an issue of recursivity if a user decided
// to probe a probe display. I ignored that. --gepr
@@ -84,10 +87,10 @@
// Probe notification mechanism added to handle automatic removal
// of probe displays when an probed object is dropped. --gepr
- objectRef = [probedObject addRef: (notify_t) notifyObjectDropped
- withArgument: (void *)probeDisplay ];
-
-
+ [probeDisplay setObjectRef: [probedObject
+ addRef: (notify_t) notifyObjectDropped
+ withArgument: (void *)probeDisplay ]];
+ [probeDisplay setRemoveRef: 1]; // set this every time a reference is added
[globalTkInterp eval:
"foreach w [busy isbusy] {busy release $w} ; update"] ;
@@ -95,7 +98,6 @@
return probeDisplay;
}
-
@end
diff -ru ../../swarm-1.0.1/src/simtools/SimpleProbeDisplay.h
simtools/SimpleProbeDisplay.h
--- ../../swarm-1.0.1/src/simtools/SimpleProbeDisplay.h Fri Feb 28 12:40:37 1997
+++ simtools/SimpleProbeDisplay.h Fri Mar 21 07:12:39 1997
@@ -18,6 +18,7 @@
int numberOfProbes;
id *widgets;
ref_t objectRef;
+ BOOL removeRef;
}
-setProbedObject: anObject;
@@ -30,6 +31,10 @@
-(char *) package ;
-(const char *) getId ;
+
+-(void) setRemoveRef: (BOOL) torf;
+-(void) setObjectRef: (ref_t) or;
+-(void) drop;
@end
diff -ru ../../swarm-1.0.1/src/simtools/SimpleProbeDisplay.m
simtools/SimpleProbeDisplay.m
--- ../../swarm-1.0.1/src/simtools/SimpleProbeDisplay.m Fri Feb 28 12:40:38 1997
+++ simtools/SimpleProbeDisplay.m Fri Mar 21 07:38:08 1997
@@ -237,6 +237,14 @@
return self;
}
+-(void) setRemoveRef: (BOOL) torf {
+ removeRef = torf;
+}
+
+-(void) setObjectRef: (ref_t) or {
+ objectRef = or;
+}
+
-(void)drop{
int i ;
@@ -259,6 +267,8 @@
[probeDisplayManager removeProbeDisplay: self];
+ if (removeRef) [probedObject removeRef: objectRef];
+
[super drop] ;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- ProbeDisplay Notification Fix,
glen e. p. ropella <=