Page 1 of 1

Problem with Quit

Posted: Thu Jun 14, 2012 10:11 pm
by c-tec
Hello,
I have a program that runs in the taskbar and opens an dialog window when needed. When this window is open and I logoff on my terminalserver, I get the message
Error BASE/1025
Parameter has a wrong data type
Quit
DC_GETLIST:EVENTLOOP(44449)
...


This is my code for the taskbar menu:

Code: Select all

LOCAL GetList[0], oMenu, aRef[2],oMenu1,oMenu2,oMenu3,oMenu4,oMenu5,oMenu6
//return .t.
if valtype(oTaskBar) = "O"
     piep(1)
     return .f.
endif

oTaskBar := TaskBarIcon():New( xbeP_User + 30 ):Create()
oTaskBar:AddIcon( 1, ICON_APP , "CT-PEN FormCommander" + Chr(13) + 'Rechts Click für das Menü' )
oFCSys:lStatTaskbar := .t.


DCSUBMENU oMenu PROMPT lmessage(1836,"Taskbar Menü") PARENT oTaskBar BARTEXT "FormCommander" OWNERDRAW BGCOLOR MENU_BARCOLOR BARFONT "10.Arial"
* 

    DCMENUITEM 'FormCommander'                       PARENT oMenu ACTION {||Thread():new():start({||formcommander()})}            BITMAP addpath(al_path,"\img\notes.gif") when 

DCREAD GUI PARENT oTaskBar EVAL {||aRef[1] := oMenu, aRef[2] := oTaskBar,formcommander()} HANDLER taskBarHandler REFERENCE @aRef
RETURN nil
I use vers 256

regards
Rudolf

Re: Problem with Quit

Posted: Thu Jun 14, 2012 10:48 pm
by c-tec
Hello Roger,
in dc_getbx.prg in line 4449
IF !oGetList:IsDesignOn .OR. oParentDlg == NIL .OR. oXbp == oParentDlg
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDIF

should this not be
IF !(oGetList:IsDesignOn .OR. oParentDlg == NIL .OR. oXbp == oParentDlg)
regards
Rudolf

Re: Problem with Quit

Posted: Thu Jun 14, 2012 11:08 pm
by c-tec
Hello Roger,
when I change it, then it works, but then pulldownmenues are no more working, strange
regards
Rudolf

Re: Problem with Quit

Posted: Fri Jun 15, 2012 11:55 am
by rdonnay
You are using build 255, not 256 because that would be the wrong line of code.
I don't know what is happening.
If you can give me a sample program that demonstrates the problem, then I can fix it for you.
If you cannot do that then put some debugging in the code as shown below.

Code: Select all

  IF Valtype(oXbp) == 'O'
    IF !oGetList:IsDesignOn .OR. oParentDlg == NIL .OR. oXbp == oParentDlg
wtl oXbp, nEvent, mp1, mp2  // <<<<<<<<<<<<< add this to write to debug.log
      oXbp:handleEvent( nEvent, mp1, mp2 )
    ENDIF
  ELSE
    BREAK
  ENDIF

Re: Problem with Quit

Posted: Fri Jun 15, 2012 10:17 pm
by c-tec
Hello Roger,
this is the debug info:
DC_XbpDialog1 1048633 0 1 <- Called From: DC_GETLIST:EVENTLOOP(4449), DC_GETLIST:READGUI(3677), DC_READGUI(101), FORMCOMMANDER(4008), (B)TASKBARMENU(954), DC_GETLIST:READGUI(3630), DC_READGUI(101), TASKBARMENU(954), PROG_START(615), PROGMAIN(132), MAIN(79), 16-06-2012 07:12:22

mp1 and mp2 ar no arrays in this case
regards
Rudolf

Re: Problem with Quit

Posted: Sat Jun 16, 2012 7:02 am
by rdonnay
The parameters look correct. I suspect that a memory corruption has occurred due to some bad C++ code in the Taskbar. I have never seen this problem before.

I suggest adding the following to _DCGETBX.PRG:

Code: Select all

  IF Valtype(oXbp) == 'O'
    IF !oGetList:IsDesignOn .OR. oParentDlg == NIL .OR. oXbp == oParentDlg
      IF nEvent == xbeP_Quit    // <<<<<<<<<<<<<<<<
         QUIT    // <<<<<<<<<<<<<<<
      ENDIF   // <<<<<<<<<<<<<<<
      oXbp:handleEvent( nEvent, mp1, mp2 )
    ENDIF
  ELSE
    BREAK
  ENDIF

Re: Problem with Quit

Posted: Mon Jun 18, 2012 1:52 am
by c-tec
Hello Roger,
thank you, works now. Is this a failure in the Taskbar source ? Do you include this solutioin in the next version ?
regards
Rudolf

Re: Problem with Quit

Posted: Mon Jun 18, 2012 10:06 am
by rdonnay
Rudolf -

The taskbar source was donated by Thomas Braun in 2003.
I haven't worked in C in over 20 years and so I prefer not to try to figure out what's wrong in the code.

My best guess is that the workaround I gave you will solve your problem because it only seems to happen when quitting.

I will put this change in build 258.

Roger

Re: Problem with Quit

Posted: Thu Jun 21, 2012 6:13 am
by c-tec
Hello Roger,
many thanks, maybe somewhere we get another taskbar lib.
regards
Rudolf