Hello,
My concern is that that code used to run once and only once in the original cefsimple and now in my app it would run several times. And indeed, new CACefHandler() would crash on the second run because its constructor was:
- Code: Select all
CACefHandler::CACefHandler()
: is_closing_(false) {
DCHECK(!g_instance);
g_instance = this;
}
CACefHandler is, for now, just a renamed SimpleHandler:
https://bitbucket.org/chromiumembedded/ ... ster#cl-21I change new CACefHandler() to CACefHandler::GetInstance() and GetInstance() to
- Code: Select all
CACefHandler* CACefHandler::GetInstance() {
if(g_instance == NULL) {
new CACefHandler();
}
return g_instance;
}
so it has proper singleton behaviour. But I'm just assuming here, should it be a singleton or not? The sample code I'm reading is inconsistent in this regard and my concern is that since I don't completely understand CEF yet I might be doing something wrong.
For example, in my own code, OnBeforeClose (
https://bitbucket.org/chromiumembedded/ ... ster#cl-59) doesn't get called. I don't know why as it's hard to debug why a piece of code doesn't get a callback. As a possible side effect of that, my application never quits.