Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
A reproducible crash of CC
ollydbg:
--- Quote from: MortenMacFly on August 07, 2011, 11:56:23 am ---Remember, the trace macro was actually only for debug purposes. I know, we mis-use it. :lol:
--- End quote ---
Agree!!!
--- Quote ---However, please don't mess with LogManager. That's not something to change. instead, we should always use events to report CC infos from threads to the plugin "main loop" itself. So instead of calling Log(...) directly, fire a custom event (implemented inside the CC plugin) and handle the call outside the thread.
--- End quote ---
Yes, correctly way we should use.
Loaden:
--- Quote from: MortenMacFly on August 07, 2011, 11:56:23 am ---we should always use events to report CC infos from threads to the plugin "main loop" itself.
--- End quote ---
Yes, this is what I called the CC's Logger.
oBFusCATed:
Loaden: do you know that the singleton pattern is considered a bad pathern? Why are you doing CCLogger::Get(), instead of having m_logger or g_logger?
Some random links:
http://blogs.msdn.com/b/scottdensmore/archive/2004/05/25/140827.aspx
http://stackoverflow.com/questions/86654/whats-wrong-with-singleton
http://aabs.wordpress.com/2007/03/08/singleton-%E2%80%93-the-most-overused-pattern/
p.s. I don't like the Manager::Get() thing, too :P
Loaden:
--- Quote from: oBFusCATed on August 07, 2011, 11:09:37 pm ---Loaden: do you know that the singleton pattern is considered a bad pathern? Why are you doing CCLogger::Get(), instead of having m_logger or g_logger?
Some random links:
http://blogs.msdn.com/b/scottdensmore/archive/2004/05/25/140827.aspx
http://stackoverflow.com/questions/86654/whats-wrong-with-singleton
http://aabs.wordpress.com/2007/03/08/singleton-%E2%80%93-the-most-overused-pattern/
p.s. I don't like the Manager::Get() thing, too :P
--- End quote ---
Singleton pattern in here, nothing bad.
I do not like global variables.
In here, we can't use member variables, It will be worse.
oBFusCATed:
Singleton is a global variable!!! They call it glorified global variable.
What do you gain by using singleton in this case? Instead of global variable or global variable hidden behind two functions cc::DebugLog and cc::Log (and of course one init function)?
BTW: Your Get() method is not thread safe:)
Also don't use double locking if you try to make it thread safe:
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
http://bartoszmilewski.wordpress.com/2008/08/04/multicores-and-publication-safety/
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version