Page 75 of 106

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 4:02 am
by Rathinagiri
mrduck wrote:Please reapply the code of clipboard, so that we can more easily understand which is the error...

METHOD Clipboard( cValue ) CLASS WINDOW
IF ::oClipboard == NIL <<<<<< this code may be moved to window.prg ???
::oClipboard := ::s_qApp:clipboard()
ENDIF
IF PCount() == 0
RETURN ::oClipboard:text( 0 )
ELSE
::oClipboard:setText( cValue, 0 )
ENDIF
RETURN NIL

oClipboard must be defined in class application, since it is a singleton anyway
Hi, I have changed clipboard functionality to dialogs.prg since clipboard is system specific and not window specific. Please see this code in /samples/misc/demo_1.prg

This is the function. Even now it gives the same GPF error.

Code: Select all

FUNCTION SetClipboardValue( cValue )
   LOCAL qClip
   qClip := QClipboard()
   qClip:clear()
   qClip:setText( cValue )
   RETURN NIL

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 5:18 am
by bedipritpal
Roberto Lopez wrote:
Roberto Lopez wrote:
Roberto Lopez wrote:Can this be caused because I'm using QT 4.7?
Using exactly the same environment, I've switched to QT 4.5.3 and HBIDE was successfully built.
And it could be a problem with MingW.

I'll try QT 4.7 again switching to a newer MingW version.
Yes, MinGW.
Read INSTALL.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 5:21 am
by bedipritpal
rathinagiri wrote: This is the function. Even now it gives the same GPF error.

Code: Select all

FUNCTION SetClipboardValue( cValue )
   LOCAL qClip
   qClip := QClipboard()
   qClip:clear()
   qClip:setText( cValue )
   RETURN NIL
Look into contrib/hbide/ideedit.prg
where this function is used. You must be doing something wrong
somewhere in class hirarchy. Try to put trace for cValue before/after :setText()
is called. Error is buried somewhere not visible.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 5:22 am
by Rathinagiri
Ok Pritpal. I will try and let you know about the results. Thanks.

Also I noted the following:

When a clipboard value is copied from other applications and used demo_1 to set clipboard value, the program is not crashed and exits normally.

However, when we use again demo_1 to set clipboard value, it crashes.

So, whenever we re-set the clipboard value from QT, the program crashes.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 8:36 am
by Rathinagiri
Hi Pritpal,

I have verified. HBIDE is also giving the same error. :(

Will it be anyway related to Windows 7 UIPermission for Clipboard activities? But, I have run the program as administrator too.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 8:44 am
by mrduck
This is the function. Even now it gives the same GPF error.

Code: Select all

FUNCTION SetClipboardValue( cValue )
   LOCAL qClip
   qClip := QClipboard()
   qClip:clear()
   qClip:setText( cValue )
   RETURN NIL
I believe this code is wrong, since, according to docs, "There is a single QClipboard object in a application, accessible as QApplication::clipboard()"

so the method

Code: Select all

METHOD Clipboard( cValue ) CLASS WINDOW
IF ::oClipboard == NIL <<<<<< this code may be moved to window.prg ???
   ::oClipboard := ::s_qApp:clipboard()
ENDIF
IF PCount() == 0
   RETURN ::oClipboard:text( 0 )
ELSE
   ::oClipboard:setText( cValue, 0 )
ENDIF
RETURN NIL 
should be better suited...

Using QClipboard() constructor is not present in Qt documentation !

Next, we can study the reason of the error.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 9:24 am
by Rathinagiri
I believe this code is wrong, since, according to docs, "There is a single QClipboard object in a application, accessible as QApplication::clipboard()"
Only after reading the docs and examples in the net, I had used QClipboard as ::s_qApp:QClipbaord()

Since Pritpal advised to use QClipboard() constructor, I have used that. Now, both the implementations give the same error. Even the error occurs in HBIDE editor too.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 10:12 am
by bedipritpal
rathinagiri wrote:Since Pritpal advised to use QClipboard() constructor, I have used that. Now, both the implementations give the same error. Even the error occurs in HBIDE editor too.
I never got such error.
Can you give me steps to reproduce ?
Chances are it will be fixed.

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 10:31 am
by Rathinagiri
My systems are Windows 7 and Vista Home edition. It happens from the first time itself in the case of Win 7 and from the second time onwards in the case of Vista.

Open HBIDE editor. Type something. Select the text. Right Click. Select Copy. Close HBIDE. The error appears.

Here is the screenshot.
hbide_crash.gif
hbide_crash.gif (265.79 KiB) Viewed 4001 times

Re: Welcome to the Project Developers' Table

Posted: Wed Oct 20, 2010 11:55 am
by Roberto Lopez
bedipritpal wrote:
Roberto Lopez wrote:
Roberto Lopez wrote:I'll try QT 4.7 again switching to a newer MingW version.
Yes, MinGW.
Read INSTALL.
Yes, it is.

I'll create new binaries including HBIDE ASAP.

Thanks.