how to break 4.5...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to break 4.5...

LawsonEnglish
Well, maybe not break, but definitely make unusable for me with no way
to back out that I am aware of.

First, install the Connectors package

then, create the fully-connected graph that I create in:
https://www.youtube.com/watch?v=JwwjOO84Sn8

Now, try to disable any kind of user interaction for edges of the graph
by doing:

NCAAConnectorMorph allInstances do: [:ea| ea lock: True].

Yes, its the wrong syntax. Yes I'm stupid. But Squeak is now permanently
locked, and I can't get around it except by force-quiting that I can see.

Squeak appears to freeze. numerous cmd-periods bring up a buncha
"NonBooleanReceiver: proceed for truth" messages, none of which can be
interacted with (not close window, not click any button, etc) and
eventually cmd-period doesn't do anything either. No menus work, etc.

Clicking inside the Squeak window actually slows down the Mac GUI when
dragging the Squeak window for a while. It seems clear the interpreter
is still running, but interface via the GUI is hosed.

Eep.


In case you were wondering, I was trying to see if I could disable
mouse-interaction with the edges of the graph as a way of speeding up
and making more reliable, interaction with the nodes...

Lawson

--
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan


tty
Reply | Threaded
Open this post in threaded view
|

Re: how to break 4.5...

tty
First, thanks for an awesome vid. Very informative.


|myMorphs|
myMorphs := Array new: 360.
0 to: 359 by:15 do:[:i | myMorphs at: i+1 put:((NCCurveMorph new) extent: 20@20;
openInWorld;
center: (450@330) + (300 *((i degreesToRadians cos)@(i degreesToRadians sin))); yourself)].


1 to:(myMorphs size - 1) do:[:i |
i+1 to: myMorphs size do:[:j |
((myMorphs at:i ) ~= nil and:(myMorphs at:j ) ~= nil)
ifTrue:[NCAAConnectorMorph fromMorph: (myMorphs at:i) toMorph:(myMorphs at:j)]]]

"tty Debug Lock"
NCAAConnectorMorph allInstances do:[:each | each lock:True].       "This locks it"
NCAAConnectorMorph allInstances inspect.                                    "about 285 instances"
Transcript clear.
NCAAConnectorMorph allInstances do:[:each | Transcript show: (each bounds);cr. ].  "works" 
NCAAConnectorMorph allInstances do:[:each | Transcript show: (each bounds);cr. each lock:true ]. "works"
NCAAConnectorMorph allInstances do:[:each | each lock:true].  "works"
True inspect.
true inspect.
NCAAConnectorMorph allInstances do:[:each | each lock:(True initializedInstance)].   "works"

I was able to recreate the lockup you described.
Changing the lock:True to lock:true (all lowercase) does not cause the lock up.

You can work through the reasoingin with the "tty Debug Lock" section in the above code.

If you do the two inspect statements at the bottom, you will see you where passing the "True class" instead of the instance "True".

cordially,

tty




Reply | Threaded
Open this post in threaded view
|

Re: how to break 4.5...

LawsonEnglish
In reply to this post by LawsonEnglish
Great! and thanks for the listing (I keep forgetting to save my workspace code from the videos :-/)

Am I right in thinking this really shouldn't permanently lock things up , even though its an obvious bug in my code?

It would be a common noob mistake and pretty awful to have happen as your first encounter with a Squeak bug.

L

On 4/15/14, 3:19 PM, gettimothy wrote:
First, thanks for an awesome vid. Very informative.


|myMorphs|
myMorphs := Array new: 360.
0 to: 359 by:15 do:[:i | myMorphs at: i+1 put:((NCCurveMorph new) extent: 20@20;
openInWorld;
center: (450@330) + (300 *((i degreesToRadians cos)@(i degreesToRadians sin))); yourself)].


1 to:(myMorphs size - 1) do:[:i |
i+1 to: myMorphs size do:[:j |
((myMorphs at:i ) ~= nil and:(myMorphs at:j ) ~= nil)
ifTrue:[NCAAConnectorMorph fromMorph: (myMorphs at:i) toMorph:(myMorphs at:j)]]]

"tty Debug Lock"
NCAAConnectorMorph allInstances do:[:each | each lock:True].       "This locks it"
NCAAConnectorMorph allInstances inspect.                                    "about 285 instances"
Transcript clear.
NCAAConnectorMorph allInstances do:[:each | Transcript show: (each bounds);cr. ].  "works" 
NCAAConnectorMorph allInstances do:[:each | Transcript show: (each bounds);cr. each lock:true ]. "works"
NCAAConnectorMorph allInstances do:[:each | each lock:true].  "works"
True inspect.
true inspect.
NCAAConnectorMorph allInstances do:[:each | each lock:(True initializedInstance)].   "works"

I was able to recreate the lockup you described.
Changing the lock:True to lock:true (all lowercase) does not cause the lock up.

You can work through the reasoingin with the "tty Debug Lock" section in the above code.

If you do the two inspect statements at the bottom, you will see you where passing the "True class" instead of the instance "True".

cordially,

tty





    


-- 
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all 

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan


tty
Reply | Threaded
Open this post in threaded view
|

Re: how to break 4.5...

tty
>>Am I right in thinking this really shouldn't permanently lock things up , even though its an obvious bug in my code?

I don't know. I will leave it to the more experienced guys to answer that.


Modifying the Morhp>>lock code to check prevents the freeze, but then you get into UI questions for which I am completely unqualified to answer.

lock: aBoolean
"change the receiver's lock property"
(aBoolean == true) | (aBoolean == false) ifTrue:[
(extension isNil and: [aBoolean not]) ifTrue: [^ self].
self assureExtension locked: aBoolean]

For example, the above "fix" does not freeze the system, but it also does not lock the morphs and does not inform the user that there was a problem....that sort of judgement is completely outside my experience.


cordially,

tty