Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

A reproducible crash of CC

<< < (4/5) > >>

thomas:

--- Quote from: oBFusCATed on August 08, 2011, 09:28:58 am ---
--- Quote from: Loaden on August 08, 2011, 05:41:11 am ---In this case, we not need thread-safe for CCLogger::Get.
CCLogger::Get should call first in CodeCompletion::CodeCompletion():

--- End quote ---
So you're admitting that you're using this singleton as glorified global variable? :)

--- End quote ---
That's exactly how the entire project is organized, every "...Manager" class, whether it's configuration, project, buildtargets or whatever.

You can debate whether that's bad design or not, whether singletons are better or worse or the same as global variables, but that's what it is, really. Someone (most probably Yiannis?) started it that way, and everyone (including me) continued that way. The fact that we use singletons everywhere didn't cause a lot of trouble during the years either. Yes, we won't win the first prize in the OOP design contest, so what. The point is, it works, and it works in a kind-of-defined way.

In at least one case (config) there is an urgent reason behind it too, in most other cases I guess one cold probably do otherwise, if one cares to spend many hours rewriting a lot of code.

oBFusCATed:

--- Quote from: thomas on August 08, 2011, 11:08:42 am ---
* There is no other reason (i.e. crash) which is obvious to me why you could not log concurrently. Unless wxWidgets GUI functions are not re-entrant, which I would seriously hope they are.
--- End quote ---
They are not, all GUI libs I've seen (MFC/Win32api, QT, wxWidgets) are intended for single threaded usage.


--- Quote from: thomas on August 08, 2011, 11:14:59 am ---In at least one case (config) there is an urgent reason behind it too, in most other cases I guess one cold probably do otherwise, if one cares to spend many hours rewriting a lot of code.

--- End quote ---
I've not said to rewrite all existing code. I know it is impossible.
I just want to not make the same mistake with the new code.
This CCLogger::Get()->BlaBla() is more typing, more instructions and more memory accesses for no added benefit/value.

thomas:
Did you try whether a critical section in TextCtrlLogger::Append does anything?

I don't believe this makes any difference, but you never know if you haven't tried...

oBFusCATed:
I haven't, the better approach is to send/post a message/event, this will be even asynchronous :)

thomas:
Yep, we could send log messages via a TCP socket.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version