Technical problem with queue


#1

Hi everyone,
I am not sure if this should work in Clarion or if there are any restrictions:
I want to display a queue within a LIST in my window. The queue is defined in a small class that is really simple constructed (create an instance of the queue, fill it with some entries).
But already the open(win) command crashes with „Internal error 01: WSLDIAL“.
I guess there is problem with the instance/scope of the queue definition. But I have no idea what to change - maybe somebody sees immediately what’s wrong. Thanks you for time & support!

  PROGRAM

  MAP
  END

CrashQueueType queue,type
cDummy        STRING(10)
            end

MyQueueClass  CLASS,TYPE

CrashQueue      &CrashQueueType

Init                            PROCEDURE
Kill                            PROCEDURE
                      END


oMyQueue      MyQueueClass

wWin WINDOW('Test'),AT(,,253,188),CENTER,GRAY,SYSTEM
    LIST,AT(2,2,244,103),USE(?ListKessel),HVSCROLL,FROM(oMyQueue.CrashQueue), |
        FORMAT('39L(2)[email protected]@')
    BUTTON('Cancel'),AT(2,108,59,20),USE(?Cancel)
  END

  CODE

  oMyQueue.Init

  OPEN(wWin)   ! -> crash

  ACCEPT
  END
  
  oMyQueue.Kill

!----------------------------------------------------  
MyQueueClass.Init  PROCEDURE

  CODE

  self.CrashQueue    &= NEW CrashQueueType 

  self.CrashQueue.cDummy = 'First'
  add(self.CrashQueue)
  self.CrashQueue.cDummy = 'Second'
  add(self.CrashQueue)

  return

MyQueueClass.Kill PROCEDURE

  CODE
  free(self.CrashQueue)
  dispose(self.CrashQueue)
  return

#2

Some info here might be handy:


#3

What are you expecting with this name? :joy:


#4

I wanted to make it easier for you to understand where the problem lies… the name says it all :wink:


#5

Thanks brahn,
I checked the prog again and the USE variable seems to be ok.
But the hint is quite good - I think the crash has to do with the link between the LIST and the queue of the class.
Is it so unusual to use a queue - that belongs to an instance of a class - in a normal LIST/Windows?


#6

Doing this works:

wWin  WINDOW('Test'),AT(,,253,188),CENTER,GRAY,SYSTEM
        LIST,AT(2,2,244,103),USE(?ListKessel),HVSCROLL,FROM('Test'), |
        FORMAT('39L(2)[email protected]@')
        BUTTON('Cancel'),AT(2,108,59,20),USE(?Cancel)
      END

  CODE

  oMyQueue.Init

  OPEN(wWin)   ! -> crash
  ?ListKessel{PROP:From} = oMyQueue.CrashQueue
  ACCEPT
  END

#7

I’m speechless…
Thanks a lot for this easy and effective solution! You saved me a lot of work with this great idea.

It seems to be a difference when the queue has been defined and linked to the list.
Thanks again, Toto


#8

Perhaps the compiler does something to the window structure and in your original, at compile time, the variable you have assigned to the FROM is a reference which makes the runtime throw a wobbly. Not too sure, the WSLDIAL stuff is kind of magical :slight_smile:


#9

Yes :slight_smile: But your explaination sounds for me as the most obvious reason.


#10

I have definitely been down this road before. PROP:From is the best solution.


#11

Sorry I’m late to this thread.
But another fix for this problem is to change the .INIT to a .CONSTRUCT
that winds up NEW’ing the Queue earlier, which is enough to solve the problem
(Tested with C10.0.12799)

I know, it seems like as long as you instantiate the queue before the open window that will be soon enough.
Well, apparently not.

FWIW, I have many LIST,USE(SomeClass.Q) in production


#12

Thank you for pointing that out. I will try it next time.