Problem with image lock up with self error:

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

Problem with image lock up with self error:

Karl Ramberg
Hi,

Image lock up doing
Preferences togglePreference: #justATest

If I change error:  to inform: in the method I do not get a image lock up.

This is in a trunk image and tested with several Cog VM on Windows.

Preferences>>togglePreference: prefSymbol
"Toggle the given preference. prefSymbol must be of a boolean preference"
(self preferenceAt: prefSymbol ifAbsent: [self error: 'unknown preference: ', prefSymbol]) togglePreferenceValue 

Karl


Reply | Threaded
Open this post in threaded view
|

Re: Problem with image lock up with self error:

David T. Lewis
On Fri, Jan 09, 2015 at 02:22:57PM +0100, karl ramberg wrote:

> Hi,
>
> Image lock up doing
> Preferences togglePreference: #justATest
>
> If I change error:  to inform: in the method I do not get a image lock up.
>
> This is in a trunk image and tested with several Cog VM on Windows.
>
> Preferences>>togglePreference: prefSymbol
> "Toggle the given preference. prefSymbol must be of a boolean preference"
> (self preferenceAt: prefSymbol ifAbsent: [self error: 'unknown preference:
> ', prefSymbol]) togglePreferenceValue
>
> Karl

Confirmed. I get the same result on Linux with an interpreter VM.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Problem with image lock up with self error:

Levente Uzonyi-2
In reply to this post by Karl Ramberg
It's because the error occurs in the critical section of AccessLock, so
it'll stay locked during error handling. This probably locks up the
debugger, because it can't access the preferences.
Here's a fix:

preferenceAt: aSymbol ifAbsent: aBlock
  "Answer the Preference object at the given symbol, or the value of aBlock if not present"

  self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
  dictionaryOfPreferences
  at: aSymbol
  ifPresent: [ :preference | ^preference ] ].
  ^aBlock value

Levente

On Fri, 9 Jan 2015, karl ramberg wrote:

> Hi,
> Image lock up doing
> Preferences togglePreference: #justATest
>
> If I change error:  to inform: in the method I do not get a image lock up.
>
> This is in a trunk image and tested with several Cog VM on Windows.
>
> Preferences>>togglePreference: prefSymbol
> "Toggle the given preference. prefSymbol must be of a boolean preference"
> (self preferenceAt: prefSymbol ifAbsent: [self error: 'unknown preference: ', prefSymbol]) togglePreferenceValue 
>
> Karl
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Problem with image lock up with self error:

Karl Ramberg
Hi,
That fixes the image lock up. 
I have commited the fix to trunk

Karl

On Fri, Jan 9, 2015 at 4:01 PM, Levente Uzonyi <[hidden email]> wrote:
It's because the error occurs in the critical section of AccessLock, so it'll stay locked during error handling. This probably locks up the debugger, because it can't access the preferences.
Here's a fix:

preferenceAt: aSymbol ifAbsent: aBlock
        "Answer the Preference object at the given symbol, or the value of aBlock if not present"

        self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
                dictionaryOfPreferences
                        at: aSymbol
                        ifPresent: [ :preference | ^preference ] ].
        ^aBlock value

Levente


On Fri, 9 Jan 2015, karl ramberg wrote:

Hi,
Image lock up doing
Preferences togglePreference: #justATest

If I change error:  to inform: in the method I do not get a image lock up.

This is in a trunk image and tested with several Cog VM on Windows.

Preferences>>togglePreference: prefSymbol
"Toggle the given preference. prefSymbol must be of a boolean preference"
(self preferenceAt: prefSymbol ifAbsent: [self error: 'unknown preference: ', prefSymbol]) togglePreferenceValue 

Karl







Reply | Threaded
Open this post in threaded view
|

Re: Problem with image lock up with self error:

David T. Lewis
That fixed it. Thanks Karl and Levente!

Dave


On Fri, Jan 09, 2015 at 11:33:15PM +0100, karl ramberg wrote:

> Hi,
> That fixes the image lock up.
> I have commited the fix to trunk
>
> Karl
>
> On Fri, Jan 9, 2015 at 4:01 PM, Levente Uzonyi <[hidden email]> wrote:
>
> > It's because the error occurs in the critical section of AccessLock, so
> > it'll stay locked during error handling. This probably locks up the
> > debugger, because it can't access the preferences.
> > Here's a fix:
> >
> > preferenceAt: aSymbol ifAbsent: aBlock
> >         "Answer the Preference object at the given symbol, or the value of
> > aBlock if not present"
> >
> >         self accessDictionaryOfPreferencesIn: [ :dictionaryOfPreferences |
> >                 dictionaryOfPreferences
> >                         at: aSymbol
> >                         ifPresent: [ :preference | ^preference ] ].
> >         ^aBlock value
> >
> > Levente
> >
> >
> > On Fri, 9 Jan 2015, karl ramberg wrote:
> >
> >  Hi,
> >> Image lock up doing
> >> Preferences togglePreference: #justATest
> >>
> >> If I change error:  to inform: in the method I do not get a image lock up.
> >>
> >> This is in a trunk image and tested with several Cog VM on Windows.
> >>
> >> Preferences>>togglePreference: prefSymbol
> >> "Toggle the given preference. prefSymbol must be of a boolean preference"
> >> (self preferenceAt: prefSymbol ifAbsent: [self error: 'unknown
> >> preference: ', prefSymbol]) togglePreferenceValue
> >>
> >> Karl
> >>

>