BUG: Empty string gives garbles output in multi column list view

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

BUG: Empty string gives garbles output in multi column list view

Frank Sonnemans-3
I wrote an application which uses a multicolumn listview to show a tabular
report. The problem I have is that when a cell contains an empty string,
random output is shown. Replacing the empty string by nil resolves the
problem, but this won't work for me because I want the columns to be sorted.
Sorting nil against a string won't work and gives a backtrace.

--------code (partial)---------
Object subclass: #ActTarget

instanceVariableNames: 'id contact company phone product type price number
probability stage status closeDate manager group reason marketSegment'

In the view:

ListViewColumn('Company')

getTextBlock=[:aTarget | aTarget company].

sortBlock=[:a :b | (a company) < (b company)]



aTarget company will return a string or '' if empty. Nil is not returned to
avoid problems with the sortblock

--------

Class
Any suggestions. To me this is a bug.

Regards,

Frank


Reply | Threaded
Open this post in threaded view
|

Re: Empty string gives garbles output in multi column list view

Ian Bartholomew-18
Frank,

> Any suggestions. To me this is a bug.

Which version of Dolphin are you using?  This sort of corruption could
occasionally occur in earlier versions but the empty string was made a read
only object in later versions (Dolphin 4 and later IIRC) to prevent these
problems.

You could still try replacing any code that uses something like

x := ''

with

x := String new

just to see if it makes a difference.

What was the random output you were seeing in the list view?

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Empty string gives garbles output in multi column list view

Blair McGlashan
"Ian Bartholomew" <[hidden email]> wrote in message
news:pmN6a.7189$Lq.587523@stones...
> Frank,
>
> > Any suggestions. To me this is a bug.
>
> Which version of Dolphin are you using?  This sort of corruption could
> occasionally occur in earlier versions but the empty string was made a
read

> only object in later versions (Dolphin 4 and later IIRC) to prevent these
> problems.
>
> You could still try replacing any code that uses something like
>
> x := ''
>
> with
>
> x := String new
>
> just to see if it makes a difference.

Just to explain what Ian is suggesting. The empty literal string is a single
shared object in Dolphin. In earlier versions it was possible to modify this
shared object with code like this (a common error):

    stream := WriteStream on: ''.
    stream nextPutAll: 'Oh dear'.

In recent Dolphin versions (I think as of D4), the empty literal string is
still shared, but is read-only, so code such as the above will give an
error.

Regards

Blair