Comments (6)
是macos下的
from webview_cef.
因为现在这个插件还不支持多实例,你在使用overlay的时候第一次关闭的时候是销毁了webviewhandler,但是Webviewhandler本身是单例的。所以这里判空会报错,如果你想支持多实例使用的话,目前这个插件还有一段路要走,我个人的fork上有个试验性的分支,但是依然面临着很多问题,尤其是面对多窗口时。
from webview_cef.
尤其是mac上面问题更多,实在是之前没有macos的技术栈,一直做的很慢 /笑哭
from webview_cef.
Hey, @SinyimZhi, I also faced that "!g_instance" problem and probably found the solution to solve it. In our case it's not about WebView multi instance, but about same instance reinitialization. We have separate screen deep inside our application which contains WebView, the business logic is to open/close it time to time. Also it seems similar problem was already mentioned in prevoius issue which was closed as not reproducible.
I think I figured out the solution. Please chech the webview_plugin.cc
file. In Dec 26 2023 commit this file was changed, but not drastically. However, these changes cause error.
I am on the recent (i.e. Jan 15 2024) commit and changed few things.
This part of handler & app initialization:
CefRefPtr<WebviewHandler> handler;
CefRefPtr<WebviewApp> app;
Was changed by me to this one:
CefRefPtr<WebviewHandler> handler(new WebviewHandler());
CefRefPtr<WebviewApp> app(new WebviewApp(handler));
And this part of CEF initialization:
void initCEFProcesses(CefMainArgs args){
mainArgs = args;
initCEFProcesses();
}
void initCEFProcesses(){
#ifdef OS_MAC
CefScopedLibraryLoader loader;
if(!loader.LoadInMain()) {
printf("load cef err");
}
#endif
handler = new WebviewHandler();
app = new WebviewApp(handler);
CefExecuteProcess(mainArgs, app, nullptr);
}
To this one:
void initCEFProcesses(CefMainArgs args){
mainArgs = args;
CefExecuteProcess(mainArgs, app, nullptr);
}
void initCEFProcesses(){
#ifdef OS_MAC
CefScopedLibraryLoader loader;
if(!loader.LoadInMain()) {
printf("load cef err");
}
#endif
CefExecuteProcess(mainArgs, app, nullptr);
}
Now everything seems working fine and I do not face any issue.
Hope this stuff can be helpful to be implemented in update and/or will be useful for further understanding.
from webview_cef.
@alldev In fact, the
CefRefPtr<WebviewHandler> handler(new WebviewHandler()); CefRefPtr<WebviewApp> app(new WebviewApp(handler));
is not quite correct because variables are initialized once on the main thread during program execution, but when initCEFProcesses are executed, they may be initialized again because initCEFProcesses may not be executed on the main thread under different operating systems.That's why i changed the code to initialized WebviewHandler、WebviewApp when initCEFProcesses is called(In fact, it is also to prepare for multiple instantiation).
However, this brings another issue, when you dispose WebViewController at dart side. CefShutdown() was called.Due to the intelligent pointer,the singleton WebviewHandler was released. And when you guys called WebViewController::initialize() again, it will try to get WebviewHandler and will not pass null checker. That's why "!g_instance" assert is Thrown out.
Above all, there is currently no good way to balance the contradiction between multiple component page instances you want and the existing single instance mode of plugins support. What can i do is try to build correct multi instance mode as fast as i can.
from webview_cef.
Related Issues (20)
- Scroll Problem on a Scrollable Screen HOT 3
- windows鼠标滚动不流畅;关于prebuilt package分发的建议 HOT 2
- Can't download file in website HOT 6
- 调用dispose方法后闪退 HOT 2
- YouTube crash with OnDidFinishLoad HOT 7
- macOS14.3 & Xcode15.2 run example report Undefined symbols HOT 4
- 第一次加载网页偶发无法加载;onUrlChanged回调未执行 HOT 2
- clang: error: no such file or directory: 'Embedded' HOT 5
- stdlib issue when build in linux HOT 1
- Blocked by CORS policy HOT 2
- macos Backspace key issue HOT 2
- m1 sonoma 14.1.2 HOT 2
- [windows] opens multiple windows and crashes on loading multiple youtube iframes HOT 2
- 初始化加载时会一闪而过flutter官网的画面,然后再到设置的url画面 HOT 2
- crash on windows7 HOT 2
- Receiving Console Messages HOT 9
- Response payload (JS answer) in executeJavaScript HOT 8
- Dispose Callback Results with App Crash HOT 2
- App Crashes on Debug Restart HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webview_cef.