Author Topic: Segmentation fault in nativeparser.cpp  (Read 21812 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Segmentation fault in nativeparser.cpp
« Reply #15 on: March 17, 2013, 03:35:34 pm »
Then, I guess compiler destroyed before cc, so crash happens.
Probably you can add an event which notifies all plugins that the unload process has started, so they can clean themselves and they can untangle some of the dependencies.
I'm not fully understand this idea.
Do you mean, if cc received a "unload start" event, it will not call some function of compiler plugin?
Can you be more specific?
Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Grad

  • Single posting newcomer
  • *
  • Posts: 9
Re: Segmentation fault in nativeparser.cpp
« Reply #16 on: March 18, 2013, 02:25:47 pm »
The crash happens like below steps(I guess):
1, app started
2, both cc and compiler plugin loaded correctly
3, user open a cbp project
4, cc start parsing (after some timer delay) and query compiler search path from compiler plugin(this internally call gcc command line)
5, user click the "close" button of the app

I had the same with older (slower) XP systems. The CC was using the log which wasn't there any more (at shutdown).
I have solved this with the appShutDown flag in OnRelease and use this same flag as argument in the ClearParsers.
In the deleteParser and RemoveProjectFromParser I use this flag to turn off the logging.

I had no problems since with shutting down.

(But the logging has nothing to do with compiler so that's strange).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Segmentation fault in nativeparser.cpp
« Reply #17 on: March 19, 2013, 03:40:18 am »
The CC was using the log which wasn't there any more (at shutdown).
I have solved this with the appShutDown flag in OnRelease and use this same flag as argument in the ClearParsers.
In the deleteParser and RemoveProjectFromParser I use this flag to turn off the logging.

I had no problems since with shutting down.

(But the logging has nothing to do with compiler so that's strange).
Can you show us the patches? Thanks.

@ALL:
About the logging in CC, why not use a wx standard log functions? It already supports messages from muti-threads.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.