1. Dan Cooperstock
  2. PowerBuilder
  3. Saturday, 19 June 2021 17:44 PM UTC

I'm seeing some weird behaviour where I suddenly get null object references on instance variables in an object. When I see it in the debugger, all instance variables have disappeared.

One example is I detect a problem, put up a messagebox (at which point the instance variables are still there), then pretty much the next line references an instance variable and crashes because all of the object's instance variables have disappeared! (It's not just that they are null - the Instance panel in the debugger is completely empty.)

I have done a full build on the project, so I know it's not incompatible code or something like that.

I'm assuming it's some sort of memory corruption but I can't imagine what is doing it at exactly that point in the code. 

Any hints about what to look for that could be doing this?

I'm using PB 2019 Build 2082.

Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 22 June 2021 17:42 PM UTC
  2. PowerBuilder
  3. # 1

Another option for sending messages to the user is to use the MicroHelp, if your app is MDI.

Starting the Really Long process....
At 20% of the Really Long process....
.
.
At 90% of the Really Long process....
Finished the Really Long Process, 76,422 rows retrieved.

// When the page is changed, set the default value for the MicroHelp:
Ready.

 

Comment
  1. Dan Cooperstock
  2. Tuesday, 22 June 2021 17:51 PM UTC
Thanks though I really doubt our users would notice that! And it's not an MDI app.
  1. Helpful
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Monday, 21 June 2021 08:33 AM UTC
  2. PowerBuilder
  3. # 2

Hi Dan,

is there anything that's being posted in your "do something long" code block? And you mention opening windows and custom messageboxes, are there any response windows involved? Because opening a response window will mess with the call stack and posted events will be executed immediately. Might be the reason your MIA objects are being destroyed prematurely.

Comment
  1. René Ullrich
  2. Monday, 21 June 2021 10:42 AM UTC
Yes, I also think that the custom messagebox may be the problem. There were some IMHO very bad changes in the past so now posted events are called (out of expected order) if you open a reponse window. This is not If you open a standard messagebox.

So you could try to replace your custom messagebox with a PB MessageBox to see if this solves the problem. If not there coul dbe another reason.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Sunday, 20 June 2021 14:03 PM UTC
  2. PowerBuilder
  3. # 3

Hi Dan;

  This sounds totally out-of-character for the IDE. I wonder if you have a flaky DLL or something? Since you are on the early GA build of PB 2019, I would suggest moving to R2 or even better R3 (MR01 - build 2703). 

Regards ... Chris

Comment
There are no comments made yet.
Dan Cooperstock Accepted Answer Pending Moderation
  1. Sunday, 20 June 2021 13:53 PM UTC
  2. PowerBuilder
  3. # 4

I've narrowed it down a bit.

We have a popup window, w_working, that just displays some text passed in with OpenWithParm, like "Working on X ..." during a potentially long process.

Usually the code looks like:

OpenWithParm(w_working, "Working on X ...")
// do something long
if IsValid(w_working) then Close(w_working)

However, we have a custom messagebox object, and in that, before displaying the message, we also have:

if IsValid(w_working) then Close(w_working)

That's so the message doesn't appear over the working window, which looks kind of weird.

The moment that happens in the messagebox (which was called from the Open event of a window, that was opened during the "do something long" part above), the instance variables of that window giving the messagebox disappear and then things end up crashing.

Does that help in any way? Is there some bug (or explainable feature) that says we shouldn't close popup windows during the Open event of other windows, that were themselves opened after the popup window was opened?

I have gotten rid of the crash for now by removing the use of the w_working window around those potentially long bits (which actually in this use case weren't really likely to be that long).

Thanks.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.