[Not a bug] ExamineDesktops()

Just starting out? Need help? Post your questions and find answers here.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

[Not a bug] ExamineDesktops()

Post by Dude »

[Edit] Since I can't post my entire code, and the problem shown below is apparently no help, so don't worry about it.

This bug seems pretty self-explanatory. I just called ExamineDesktops(), and then DesktopWidth() is complaining that I didn't? :shock:

And yes, the "monitors" variable is local to that code (it's NOT global or set anywhere else).

Image
Last edited by Dude on Sun Sep 24, 2017 7:58 am, edited 5 times in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ExamineDesktops() must be called bug

Post by mk-soft »

No problem her...

PB-Version ?
OS-Version ?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ExamineDesktops() must be called bug

Post by Dude »

I have Windows 7 Ultimate (64-bit). Running PureBasic 5.60 (32-bit version), as shown in IDE status bar.

It doesn't happen all the time; just occasionally, so it's annoying. ExamineDesktop() is in a thread, and that's the ONLY place in the source where ExamineDesktops() is called; and thread safety is on.

I don't even know why the red error line is happening. DesktopWidth() should only be called if "monitors" is non-zero (ie. successful).
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Re: ExamineDesktops() must be called bug

Post by Fluid Byte »

Assumptions, nothing more. Show us the whole code or a snippet that demonstrates the problem, otherwise this discussion is pointless.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ExamineDesktops() must be called bug

Post by Dude »

Fluid Byte wrote:Show us the whole code or a snippet that demonstrates the problem
I think my screenshot does that job quite nicely. No? The program flow and logic is there to see.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: ExamineDesktops() must be called bug

Post by luis »

Dude wrote: I think my screenshot does that job quite nicely. No?
No.
Dude wrote: ExamineDesktop() is in a thread
good lord of programmers hit him on the head ... I don't see any of that in the self-explanatory screenshot.

"thread" in the window is not enough to follow the code flow, also why one should manually copy some code to test it when he can paste it ?

Not to mention the code shown is just a piece of something, not something you can run.
Last edited by luis on Wed Jun 14, 2017 11:15 am, edited 1 time in total.
"Have you tried turning it off and on again ?"
A little PureBasic review
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ExamineDesktops() must be called bug

Post by Dude »

Last time I checked, PureBasic was a top-down compiler... so if ExamineDesktops() appears a few lines before DesktopWidth(), as shown in my screenshot, then why is this error even occurring? That's what this bug report is all about.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: ExamineDesktops() must be called bug

Post by Little John »

Dude wrote:
Fluid Byte wrote:Show us the whole code or a snippet that demonstrates the problem
I think my screenshot does that job quite nicely. No?
No.
Dude wrote:That's what this bug report is all about.
As already has been told you, this is not a serious bug report at all.
[u]Fred[/u] wrote:You will need to post full working snippet if you want us to look at a bug, because toying with an incomplete code is just waste of time as we don't even know if we meet the same conditions.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ExamineDesktops() must be called bug

Post by Dude »

Little John wrote:As already has been told you, this is not a serious bug report at all.
Okay, forget it. I'll retract the report. Sorry for wasting everyone's time.
Last edited by Dude on Wed Jun 14, 2017 1:38 pm, edited 1 time in total.
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Not a bug] ExamineDesktops()

Post by luis »

But Dude, you don't need to retract it, maybe it's a bug.
You just have to post some runnable code showing the problem, even if does not happen every time.
You have a big advantage in trying to do so compared to us, since you have some actual code where this is happening.

For example, this works for me

Code: Select all

CompilerIf (#PB_Compiler_Thread = 0)
 CompilerError "Please enable THREADSAFE in the compiler options"
CompilerEndIf

Procedure t (dummy)
 d = ExamineDesktops()
 If d = 0
    Debug "ouch"
    CallDebugger
 EndIf

 x = DesktopWidth(0)
 y = DesktopHeight(0)
 Debug x
EndProcedure

Procedure main()
 h = CreateThread(@t(), 0)
 WaitThread(h)
EndProcedure

For k = 1 To 1000
    main()
Next
Anyway, if you tried to create a smaller code reproducing the problem and you didn't succeed then ok.
A "generic" heads up about a problem even it's not confirmed by others may still have some value for the developer who has access to the source code of those functions.
But you didn't say that. :wink:
"Have you tried turning it off and on again ?"
A little PureBasic review
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: [Not a bug] ExamineDesktops()

Post by Dude »

All I want to know, why does DesktopWidth() fail when ExamineDesktops() was just called before it? That's the "bug". That error should ONLY occur if ExamineDesktops() was NOT called first, right? But we can all plainly see from my screenshot that it WAS called, literally just a few lines prior. Not in another thread. Not elsewhere in my code. Doesn't make sense.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: [Not a bug] ExamineDesktops()

Post by Little John »

Dude wrote:All I want to know, why does DesktopWidth() fail when ExamineDesktops() was just called before it?
And it seems that you are not the only one who wants to know that ...

Anyway, just shouting "Bug!" doesn't give the answer. If you want to help us finding out the reason why, it is essential that we first can reproduce the issue! And this is especially important for the PB team for fixing the bug, BTW (in case this turns out to be actually a bug).

Make a copy of your program and remove all code that is not needed for reproducing the issue, until you have isolated the problem. Yes, it is a tedious process, but that's the only way. Me and many other people here have done so in the past dozens of times. So maybe you want to do so as well in order to get your answer, and perhaps also to contribute to improving PureBasic?
Post Reply