Bug 462108 - Gwenview crashes in KWayland::Client::Surface::operator wl_surface when attempting to Open With > Other Application
Summary: Gwenview crashes in KWayland::Client::Surface::operator wl_surface when attem...
Status: RESOLVED FIXED
Alias: None
Product: kwayland
Classification: Frameworks and Libraries
Component: client (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-11-21 21:49 UTC by Nate Graham
Modified: 2022-11-28 07:56 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2022-11-21 21:49:03 UTC
Everything KDE from current git master on top of Fedora 37.


STEPS TO REPRODUCE
1. Open an image in Gwenview
2. Right-click > Open With > Other application


OBSERVED RESULT
#0  KWayland::Client::Surface::operator wl_surface* (this=this@entry=0x0)
    at /home/nate/kde/src/kwayland/src/client/surface.cpp:240
#1  0x00007ffff02cb618 in KWayland::Client::XdgExporterUnstableV2::Private::exportTopLevelV2 (
    this=0x350d580, surface=0x0, parent=0x341e020)
    at /home/nate/kde/src/kwayland/src/client/xdgforeign_v2.cpp:64
#2  0x00007ffff0337028 in XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}::operator()(unsigned int, unsigned int) const (version=<optimized out>, name=<optimized out>, 
    __closure=0x350dda0)
    at /home/nate/kde/src/plasma-integration/src/platformtheme/kdeplatformtheme.cpp:107
#3  QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<unsigned int, unsigned int>, void, XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}>::call(XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}&, void**) (arg=<optimized out>, 
    f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#4  QtPrivate::Functor<XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}, 2>::call<QtPrivate::List<unsigned int, unsigned int>, void>(XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}&, void*, void**) (arg=<optimized out>, f=...)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#5  QtPrivate::QFunctorSlotObject<XdgWindowExporterWayland::run(QWidget*)::{lambda(unsigned int, unsigned int)#1}, 2, QtPrivate::List<unsigned int, unsigned int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=<optimized out>, this_=0x350dd90, r=<optimized out>, 
    a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#6  0x00007ffff50db9a6 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffcc70, r=<optimized out>, 
    this=0x350dd90) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#7  doActivate<false> (sender=0x24daf90, signal_index=33, argv=0x7fffffffcc70)
    at kernel/qobject.cpp:3919
#8  0x00007ffff50d6927 in QMetaObject::activate (sender=<optimized out>, 
    m=m@entry=0x7ffff030dee0 <KWayland::Client::Registry::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=30, argv=argv@entry=0x7fffffffcc70)
    at kernel/qobject.cpp:3979
#9  0x00007ffff0288208 in KWayland::Client::Registry::exporterUnstableV2Announced (
    this=<optimized out>, _t1=<optimized out>, _t2=<optimized out>)
    at /home/nate/kde/build/kwayland/src/client/KF5WaylandClient_autogen/EWIEGA46WW/moc_registry.cpp:1292
#10 0x00007ffff35466d6 in ffi_call_unix64 () at ../src/x86/unix64.S:105
#11 0x00007ffff3543492 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, 
    rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:672
#12 0x00007ffff4c41e53 in wl_closure_invoke (closure=closure@entry=0x7fffd800b860, 
    target=<optimized out>, target@entry=0x350e170, opcode=opcode@entry=0, data=<optimized out>, 
    flags=1) at ../src/connection.c:1025
#13 0x00007ffff4c425f3 in dispatch_event (display=display@entry=0x4da5f0, queue=0x4da6c0)
    at ../src/wayland-client.c:1595
#14 0x00007ffff4c427bc in dispatch_queue (queue=0x4da6c0, display=0x4da5f0)
    at ../src/wayland-client.c:1741
#15 wl_display_dispatch_queue_pending (display=0x4da5f0, queue=0x4da6c0)
    at ../src/wayland-client.c:1983
#16 0x00007ffff4124695 in QtWaylandClient::QWaylandDisplay::flushRequests (this=<optimized out>)
    at /usr/src/debug/qt5-qtwayland-5.15.6-1.fc37.x86_64/src/client/qwaylanddisplay.cpp:253
#17 0x00007ffff50dbb2f in doActivate<false> (sender=0x4f4780, signal_index=4, argv=0x7fffffffd0e0)
    at kernel/qobject.cpp:3931
#18 0x00007ffff50d6927 in QMetaObject::activate (sender=sender@entry=0x4f4780, 
    m=m@entry=0x7ffff536cae0 <QAbstractEventDispatcher::staticMetaObject>, 
    local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3979
#19 0x00007ffff50a4d97 in QAbstractEventDispatcher::awake (this=this@entry=0x4f4780)
    at .moc/moc_qabstracteventdispatcher.cpp:149
#20 0x00007ffff50f905d in QEventDispatcherGlib::processEvents (this=0x4f4780, flags=...)
    at kernel/qeventdispatcher_glib.cpp:430
#21 0x00007ffff50a6c1a in QEventLoop::exec (this=this@entry=0x7fffffffd200, flags=..., 
    flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#22 0x00007ffff50aece2 in QCoreApplication::exec ()
    at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#23 0x00007ffff575fbe0 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#24 0x00007ffff5faec79 in QApplication::exec () at kernel/qapplication.cpp:2829
#25 0x00000000004374eb in main (argc=<optimized out>, argv=<optimized out>)
    at /home/nate/kde/src/gwenview/app/main.cpp:213


EXPECTED RESULT
App chooser dialog
Comment 1 Harald Sitter 2022-11-23 10:47:18 UTC
Is that on wayland or x11?
Comment 2 Bug Janitor Service 2022-11-23 11:24:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/60
Comment 3 Harald Sitter 2022-11-28 07:56:04 UTC
Git commit 89eeaddbf2d4d7532313200ea7163d9cd35710a0 by Harald Sitter.
Committed on 24/11/2022 at 11:14.
Pushed by sitter into branch 'master'.

create a window handle before trying to export windows

this prevents crashing when the window is foreign, consequently has no
handle, and we then pass nullptrs into
KWayland::Client::Surface::fromWindow

M  +7    -0    src/platformtheme/kdeplatformtheme.cpp

https://invent.kde.org/plasma/plasma-integration/commit/89eeaddbf2d4d7532313200ea7163d9cd35710a0