Author Topic: A reproducible crash of CC  (Read 24518 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: A reproducible crash of CC
« Reply #15 on: August 08, 2011, 11:14:59 am »
In this case, we not need thread-safe for CCLogger::Get.
CCLogger::Get should call first in CodeCompletion::CodeCompletion():
So you're admitting that you're using this singleton as glorified global variable? :)
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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: A reproducible crash of CC
« Reply #16 on: August 08, 2011, 12:42:53 pm »
  • 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.
They are not, all GUI libs I've seen (MFC/Win32api, QT, wxWidgets) are intended for single threaded usage.

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.
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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: A reproducible crash of CC
« Reply #17 on: August 11, 2011, 11:59:25 am »
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...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: A reproducible crash of CC
« Reply #18 on: August 11, 2011, 12:30:04 pm »
I haven't, the better approach is to send/post a message/event, this will be even asynchronous :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: A reproducible crash of CC
« Reply #19 on: August 11, 2011, 03:26:22 pm »
Yep, we could send log messages via a TCP socket.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: A reproducible crash of CC
« Reply #20 on: August 11, 2011, 03:46:12 pm »
Hm, probably you forget the smiley in the previous post? :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]