Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

stack overflow error

 
Post new topic   Reply to topic    Bay Six Software Forum Index -> WMLiberty DLL
View previous topic :: View next topic  
Author Message
carlo
Guest





PostPosted: Nov 27th, 2007, 10:02am    Post subject: stack overflow error Reply with quote

Dear Brent :

I have been using WMLiberty since long time in one of my project to trap WM_SIZE , WM_ENTERSIZEMOVE. Everythiing goes fine, after compiling or in debugging mode.

Recently, I decided to add TABs in my project to optimize user interface. So I tried to use WMLiberty to trap WM_NOTIFY to detect when tabs are pressed. It is too complicated in my project using Timer to check which Tab is actually pressed as in Alyce Watson's example.
Problems started. Sometimes software stops without any reason, and if I run it in debug mode (ALT+F5), a "stack overflow error" appears after a while.

Have you already found such type of error? Might it be related to my PC configuration? I tried on XP sp2 and on Win2000 sp4, and similar behavior occurred in both cases.

Thanks for help.

Yours Carlo
Coul
Back to top
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Nov 28th, 2007, 6:51pm    Post subject: Re: stack overflow error Reply with quote

Hi Carlo,

(I replied to this yesterday on the way out the door. Obviously it didn't go through.)

I don't think this is absolutely a bug in WMLiberty. I've mentioned it before that debugging becomes much more difficult when WMLiberty is used. It may be that LB's callback mechanism isn't designed to be used the way WMLiberty makes it work. If you need to know that values of variables while WMLiberty is in effect, my only suggestion is to use PRINTs to the main window.

Concerning tab controls, I've attempted to make a general framework for creating a standard Options or Preferences dialog with tabs. You might be able to pull it out of the last ViviFire's source. Its usage begins in Function wndOptions.Open$. Even if you don't use my framework, using container controls is especially helpful with tabs.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
carlo
Guest





PostPosted: Nov 29th, 2007, 5:50pm    Post subject: Re: stack overflow error Reply with quote

Dear Brent:
Thanks so much for the reply.
I'll think about your suggestions and I'll keep you informed.

Thanks again.

Yours Carlo
Back to top
metro
New Member


Joined: 29 Apr 2013
Posts: 2

PostPosted: Jan 12th, 2020, 3:43am    Post subject: Re: stack overflow error Reply with quote

Hi Brent,
I have an issue trying to capture a doubleclick in a listview, because of my limited understanding of callbacks I cannot figure out to call a sub from the Function OnNotify
without getting a stack overflow after 7 doubleclicks.

Any chance you have the time to shed some light on how I can achieve that?
Forum post here Libertybasiccom.proboards.com/thread/871/listview-capture-doubleclick

thanks in advance

Laurie
Back to top
View user's profile Send private message
Brent
Site Admin


Joined: 01 Jul 2005
Posts: 797

PostPosted: Jan 12th, 2020, 8:53pm    Post subject: Re: stack overflow error Reply with quote

Hi metro,
I see from the replies to your post on Proboards that Rod may have solved your problem. In any case, I'll just say that Rod's solution is similar to what I would have suggested.
The most common error people make is trying to do too much inside the WM handler. You should get out as quickly as possible. If your code takes too long, the handler function could be called again before it's finished.
The best practice is to set a flag inside the handler function. Then, inside your scan loop, check the flag, and do what needs to be done if it's set.
Rod mentions reentrant code, which is a procedure that doesn't depend on global variables. Window procedures must be reentrant, as stated somewhere in the Windows API reference. Any time you use WMLiberty, you are effectively making a window procedure, so it needs to be reentrant.
But the problem with this is that structs in LB are always global. Many notifications require us to use structs, but they could be "clobbered" if the handler is called again. I recommend pulling out all needed fields into local variables immediately after the struct is filled, like I did with iItem.

_________________
Brent
Back to top
View user's profile Send private message Send e-mail
metro
New Member


Joined: 29 Apr 2013
Posts: 2

PostPosted: Jan 12th, 2020, 10:32pm    Post subject: Re: stack overflow error Reply with quote

Thanks Brent,
I appreciate you responding , I certainly need to spend a lot more time getting to understand
windows messaging. I will now endeavour to read up on reentrant procedures.
Thanks for your commitment to enhancing LB

all the best

Laurie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Bay Six Software Forum Index -> WMLiberty DLL All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Lo-Fi Version
Powered by phpBB © 2001, 2005 phpBB Group