Segmentation Fault with wx.dataview.DataViewListCtrl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Segmentation Fault with wx.dataview.DataViewListCtrl

Chris Norman
Hi all,
I have an application:
You log in, and a new thread is started to do the logging in (to prevent the GUI from blocking), then another window is opened, and the logon frame is closed.

This all works fine, until I try to populate my DataViewListCtrl with 1 or more rows after the login process is finished, as part of MainFrame.Show().

When I try this, I get segmentation fault or worse.

Any ideas why?

Cheers,

Take care,
Chris Norman



--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation Fault with wx.dataview.DataViewListCtrl

Tim Roberts
Chris Norman wrote:
Hi all,
I have an application:
You log in, and a new thread is started to do the logging in (to prevent the GUI from blocking), then another window is opened, and the logon frame is closed.

This all works fine, until I try to populate my DataViewListCtrl with 1 or more rows after the login process is finished, as part of MainFrame.Show().

When I try this, I get segmentation fault or worse.

Are you opening your second window from the second thread?  If so, that's the problem.

You don't have just one message queue in your process.  Instead, there is one message queue for each thread, and windows are "owned" by the thread that created them.  So, if you create a window in a secondary thread, the creation messages will go to that thread's message queue.  You probably do not have another MainLoop call running in that thread, so no one will ever process those messages.

Unless you're doing something very special, you should make sure that ALL of your GUI activities happen on your main thread.  In your case, that means the login thread should use something like wx.CallAfter to transition back to the main thread to do the GUI work.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation Fault with wx.dataview.DataViewListCtrl

Chris Norman
Hi,
I was using wx.CallAfter, but I was rushing, and made some stupid mistakes.

Went away and did the washing up, and now it works.

Thanks for your help.

Take care,
Chris Norman



On 11 May 2015, at 22:19, Tim Roberts <[hidden email]> wrote:

Chris Norman wrote:
Hi all,
I have an application:
You log in, and a new thread is started to do the logging in (to prevent the GUI from blocking), then another window is opened, and the logon frame is closed.

This all works fine, until I try to populate my DataViewListCtrl with 1 or more rows after the login process is finished, as part of MainFrame.Show().

When I try this, I get segmentation fault or worse.

Are you opening your second window from the second thread?  If so, that's the problem.

You don't have just one message queue in your process.  Instead, there is one message queue for each thread, and windows are "owned" by the thread that created them.  So, if you create a window in a secondary thread, the creation messages will go to that thread's message queue.  You probably do not have another MainLoop call running in that thread, so no one will ever process those messages.

Unless you're doing something very special, you should make sure that ALL of your GUI activities happen on your main thread.  In your case, that means the login thread should use something like wx.CallAfter to transition back to the main thread to do the GUI work.
-- 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.