Cqoicebordel / webslice-plasmoid

Add a slice of web on your desktop. https://www.pling.com/p/998902/
http://www.cqoicebordel.net/webslice-plasmoid/
GNU Affero General Public License v3.0
30 stars 12 forks source link

Crash when webslice tries to open new window #22

Open jmcs opened 4 years ago

jmcs commented 4 years ago

When I try to open a link with target="_blank" or middle-click a link the application hosting the applet crashes (I tested with plasma desktop and latte) and restarts. I

When I latte in debug mode, the debug lines after I press the link are:

KCrash: Attempting to start /usr/bin/latte-dock
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = latte-dock path = /usr/bin pid = 114635
KCrash: Arguments: /usr/bin/latte-dock -dr 
KCrash: Attempting to start /usr/lib/drkonqi
[Warning : 18:33:17.834834] - "QSocketNotifier: Invalid socket 8 and type 'Read', disabling..."
[Warning : 18:33:17.834834] - "QSocketNotifier: Invalid socket 11 and type 'Read', disabling..."
[Warning : 18:33:17.834834] - "QSocketNotifier: Invalid socket 32 and type 'Read', disabling..."
fish: Job 2, “latte-dock -dr” terminated by signal SIGSEGV (Address boundary error)
Cqoicebordel commented 4 years ago

That is very weird. Are you on the latest version of the plasmoid ? (there was a release a short time ago, the 2.0. You can check you have it if there is a zoom factor setting just below the URL) If you are on the latest version, it's worse than weird, because the only thing I do is calling the default browser, using the Qt API. Nothing fancy : https://github.com/Cqoicebordel/webslice-plasmoid/blob/98aba19ff261dff6b0a5747815b63f1fbbb24dfc/cqcb.plasma.webslice/contents/ui/main.qml#L208

I'm sorry, but beyond that, I have no clue. The crashlog you shared contains only references to Latte-Dock, nothing I can use :/ Maybe they can do something ?

jmcs commented 4 years ago

I installed the latest version from the releases page (https://github.com/Cqoicebordel/webslice-plasmoid/releases/download/2.0/cqcb.plasma.webslice.plasmoid)

The crash also happens if I put the applet in the desktop, so it doesn't seem to be just latte. Is there any way to see the plasmoid logs?

Cqoicebordel commented 4 years ago

No idea how.

You could try running it in a window though : plasmoidviewer -a cqcb.plasma.webslice There, if it would crash, it would show more info.

But I use that webslice extensively (I must have ~10 in my line of sight right now), in a panel or on the desktop, and no crash for me, at all.

What version of Plasma do you use ? (

jmcs commented 4 years ago

I'm using Plasma 5.19.3, KDE Frameworks 5.72.0, and Qt 5.15.0

One weird thing, is that "Open current URL in default browser" works.

When I executed the applet in plasmoidviewer I got:

plasmoidviewer -a cqcb.plasma.webslice
QML debugging is enabled. Only use this in a safe environment.
file:///usr/lib/qt/qml/QtQuick/Controls/Styles/Plasma/ScrollViewStyle.qml:60:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
qml: View QML loaded
org.kde.plasmaquick: Applet preload policy set to 1
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:76:9: Unable to assign [undefined] to QStringList
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:75:9: Unable to assign [undefined] to int
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:75:9: Unable to assign [undefined] to int
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:76:9: Unable to assign [undefined] to QStringList
Cyclic dependency detected between "file:///usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml" and "file:///usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml"
file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/main.qml:274:5: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
Toolbox not loading, toolbox package is either invalid or disabled.
qml: New Containment: ContainmentInterface(0x55cf97db5250)
WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.
file:///home/jsantos/.local/share/plasma/plasmoids/cqcb.plasma.webslice/contents/ui/main.qml:126:9: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:76:9: Unable to assign [undefined] to QStringList
file:///usr/share/plasma/wallpapers/org.kde.image/contents/ui/main.qml:75:9: Unable to assign [undefined] to int
Error: cannot change the containment to AppletsLayout
file:///usr/share/plasma/shells/org.kde.plasma.plasmoidviewershell/contents/configuration/AppletConfiguration.qml:153:9: QML RowLayout: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
Cyclic dependency detected between "file:///usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml" and "file:///usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml"
QQmlEngine::setContextForObject(): Object already has a QQmlContext
Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations.
file:///usr/share/plasma/shells/org.kde.plasma.plasmoidviewershell/contents/configuration/AppletConfiguration.qml:213:21: QML StackView: Binding loop detected for property "height"
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = plasmoidviewer path = /usr/bin pid = 3206
KCrash: Arguments: /usr/bin/plasmoidviewer -a cqcb.plasma.webslice 
KCrash: Attempting to start /usr/lib/drkonqi
Cqoicebordel commented 4 years ago

That is weirder. The "Open current URL…" uses the same code. https://github.com/Cqoicebordel/webslice-plasmoid/blob/98aba19ff261dff6b0a5747815b63f1fbbb24dfc/cqcb.plasma.webslice/contents/ui/main.qml#L292

Also, the log doesn't inform me much, sadly. Only a warning about something totally unrelated.

The only thing I can think of right now is if it's on weird links. Like it's not a real link, it's JS underneath.
Have you been able to reproduce on the default page (cqoicebordel.net) ?
Have you been able to reproduce with the context menu "Open link in default browser" ?

I'm not on those version of Plasma/Qt yet. So I can't test further.
Sadly, I think you'll have to live with it for a little while :(

jmcs commented 4 years ago

The problem also happens with the default page but "Open link in default browser" is working, so I think the problem is with how the signal is connected. I'll try to make a go at it myself, but I don't have any experience with QML.

Cqoicebordel commented 4 years ago

I started making the plasmoid without knowing anything about QML :D
The doc is awful on it. Really, really awful.

But if you want to have a go, please do ! I'll always welcome pull requests :)

To guide you a bit : everything is done in the main.qml.
On l215, I handle the new window requested. It just sets a boolean.
On l205, if the boolean is set it stops the navigation of the webview, and opens the default browser.
I did it this way, because I didn't find any other way to handle ctrl+click and middle click. Before I had a MouseArea above the webview, to capture mouse events, but it doesn't work anymore, because the WebEngineView doesn't allow it, it seems (again, no doc).
The doc for the webview is here : https://doc.qt.io/qt-5.15/qml-qtwebengine-webengineview.html

The only issue I could imagine is if the request.url is empty. What I would recommend to test would be to add a line console.log("test : " + request.url); just before the Qt.openUrlExternally. That way, you would see if there is in fact an URL in that variable when it crashes.

Also, you should go to ~/.local/share/plasma/plasmoids/cqcb.plasma.webslice/ to edit mail.qml, and then be on the metadata.desktop level when you run plasmoidviewer -a . (or stay in the ui folder and run plasmoidviewer -a ../.. ;) )