Wojtek Lerch
|
RE: Problem when using PtHold()
|
Wojtek Lerch
07/09/2014 8:39 PM
post111008
|
RE: Problem when using PtHold()
How do you receive the message? Is your code multithreaded? Could I see a stack trace from a core file?
What are you trying to achieve by calling PtHold() without (as it seems) calling PtRelease()? The purpose of PtHold()
it to prevent widgets from redrawing themselves multiple times when you're making multiple changes to them, and the
intended use is that you call PtHold(), then make your changes to widgets, and then making a matching call to
PtRelease(). Yes, PtHold() "just" increments a counter, but it has to find the counter first (and that's probably where
it crashes for you) and there are quite a few pieces of code that the counter affects. The expectation is that you
should have a matching PtRelease() (in the same thread) for every PtHold() before you return to the event-processing
loop, and that you will either not do anything blocking in between, use one of Photon's "modal" mechanisms to do the
blocking, or call PtFlush() before blocking, to ensure that the widgets redraw themselves according to their current
state before you block.
> -----Original Message-----
> From: Aram Kim [mailto:community-noreply@qnx.com]
> Sent: July-09-14 8:11 PM
> To: photon-graphics
> Subject: Problem when using PtHold()
>
> I'm developing a graphical user interface software using PhAB.
>
> I made some simple program.
> It's function is like this: button click -> just call PtHold()
>
> on_button_click()
> {
> PtHold();
> }
> It works well.
>
>
> But I changed it like this: button click -> send event to server -> receive
> response from server -> call PtHold()
>
> regist_receive(&receive_from_server);
>
> on_button_click()
> {
> send_to_server();
> }
>
> receive_from_server()
> {
> PtHold();
> }
>
> In this case program causes memory fault every time. (SIGSEGV) It is same
> for PtRelease() too.
>
> As I know PtHold() just increases count. I guest it's implementation would be
> simple.
> So I can not image why it causes memory fault. It is so weird.
> Anybody can explain about this phenomenon?
>
>
>
> _______________________________________________
>
> Photon microGUI
> http://community.qnx.com/sf/go/post111007
> To cancel your subscription to this discussion, please e-mail photon-graphics-
> unsubscribe@community.qnx.com
|
|
|