Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

codecompletion plugin lead codeblocks crash, do GUI operation in worker thread

(1/7) > >>

kipade:
I am using codeblocks under linux, I have tested under several distributions, but got the same result.
CodeBlocks always crash during working, due to codecompletion plugin.
I have had a look on its source code, I want to know why it must do GUI operation in non-main thread, but in worker thread, which cause crashing.

ollydbg:

--- Quote from: kipade on February 09, 2014, 03:05:22 pm ---I am using codeblocks under linux, I have tested under several distributions, but got the same result.
CodeBlocks always crash during working, due to codecompletion plugin.
--- End quote ---
Me too, but it is really hard to catch the bug, I even don't have ways to reproduce some hang bug. Sometimes, it works, sometimes, it hangs.


--- Quote ---I have had a look on its source code, I want to know why it must do GUI operation in non-main thread, but in worker thread, which cause crashing.

--- End quote ---
In CC, the symbol browser trees (wxTreeCtrl) were built from a thread class named ClassBrowserBuilderThread. The reason I think is that the tree can have many labels(Tokens), and it take several seconds to build the tree, so the devs put those operations in a worker thread. This was done years before I becomes a C::B developer.

Do you think there are some better solution?

BTW: I'm not sure which code cause the crash, maybe it is not the GUI operation in non-main thread. CC code contains a lot of mutex lockers, I hate them, but I also don't know how to fix them. So, comments/solutions/patches are all welcome.

kipade:
hello ollydbg, thanks for your reply. As you said, it crashes mostly at BuildTree here, which do some UI operations.
And, I have no further ideas about that before I have a deep look on CB's source code. But, its a common method to do UI operations in worker thread is via notifications, right?
Mightbe, the operations and data should be separated, for this condition.

ollydbg:

--- Quote from: kipade on February 10, 2014, 09:00:59 am ---...But, its a common method to do UI operations in worker thread is via notifications, right?
--- End quote ---
Basically, all the UI operations should be put in the main thread, note the bottle neck is building the big wxTreeCtrl, so notification method is not involved here.


--- Quote ---Mightbe, the operations and data should be separated, for this condition.

--- End quote ---
Yes, they should be separated, but if you want to construct a big wxTreeCtrl, what is a good method?

kipade:
Mightbe a big TreeCtrl was not necessary, a ugly way is to define a custom event to do such UI operations, just use custom data and callback method, I do not think its impossiable.

Navigation

[0] Message Index

[#] Next page

Go to full version