| Summary: | dolphin wont save the size nor window position when closed and reopened | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-kxmlgui | Reporter: | simonlang1984 |
| Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | Ben.Kevan, cfeck, hrvoje.senjan, mklapetek, simonandric5, simonlang1984, thomas.luebking, tittiatcoke |
| Priority: | NOR | ||
| Version First Reported In: | 5.0.0 | ||
| Target Milestone: | --- | ||
| Platform: | Kubuntu | ||
| OS: | Linux | ||
| URL: | https://git.reviewboard.kde.org/r/120078/ | ||
| Latest Commit: | http://commits.kde.org/kxmlgui/1b9eed7738470ddfd495ded2e023aef6b8d079e5 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
| Bug Depends on: | 338804 | ||
| Bug Blocks: | |||
|
Description
simonlang1984
2014-07-11 09:37:08 UTC
Are there any other KF5 applications with the same bug? It could be a problem with KMainWindow/KConfig integration. @christoph this looks to be the case with Konsole and Kate as well. But not with Quassel IRC for example. anything else i could/should test? Confirmed also with Okteta, so it's definitively not a Dolphin problem. I've been doing some investigation into this. It looks like setting a central widget (setCentralWidget()) on KXmlGuiWindow breaks restoring the size because of some code in QWidget. I'll see where I can get and will keep this bug updated. I hate to do a +1, but I also see this on many qml based system configuration screens from systemsettings. *** Bug 338212 has been marked as a duplicate of this bug. *** Is there any update on this bug ?? More and more programs are being ported to Frameworks, but all suffer from the same issue. And this becomes slowly quite annoying. yep i can confirm that this is still an issue. and as long as it's not fixed i'll stay with kde4 (which is very awesome and i am sure kde devs will bring kde plasma next to at least that point if not even better) This is a bug in Qt -- https://bugreports.qt-project.org/browse/QTBUG-40584 You might want to ping it there, that would be bigger help actually ;) Hi Martin, Wasn't aware that there was a QTBUG for it :) Added a comment and a vote. Thanks Possible workaround (untested) - adapted from https://git.reviewboard.kde.org/r/119594/ diff --git a/src/kmainwindow.cpp b/src/kmainwindow.cpp index e273a76..be95a42 100644 --- a/src/kmainwindow.cpp +++ b/src/kmainwindow.cpp @@ -609,6 +609,10 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg) if (!d->sizeApplied) { KWindowConfig::restoreWindowSize(windowHandle(), cg); + // NOTICE: QWindow::setGeometry() does NOT impact the backing QWidget geometry even if the platform + // window was created -> QTBUG-40584. We therefore copy the size here. + // TODO: remove once this was resolved in QWidget QPA + resize(windowHandle()->size()); d->sizeApplied = true; } looks like this has some effect; with dolphin at least, size is now saved. however the patch triggers kwrite segfault (this is with the Qt patch applied):
Thread 1 (Thread 0x7ffff7f4e7c0 (LWP 19656)):
#0 0x00007ffff619a098 in KMainWindow::applyMainWindowSettings(KConfigGroup const&) (this=this@entry=0x6a34a0, cg=...)
at /usr/src/debug/kxmlgui-5.1.0git/src/kmainwindow.cpp:616
#1 0x00007ffff61d2e72 in KXmlGuiWindow::applyMainWindowSettings(KConfigGroup const&) (this=0x6a34a0, config=...)
at /usr/src/debug/kxmlgui-5.1.0git/src/kxmlguiwindow.cpp:374
#2 0x00007ffff619a44c in KMainWindow::setAutoSaveSettings(QString const&, bool) (this=0x6a34a0, groupName=..., saveWindowSize=<optimized out>) at /usr/src/debug/kxmlgui-5.1.0git/src/kmainwindow.cpp:705
#3 0x00007ffff7bd3fc8 in () at /usr/lib64/libkdeinit5_kwrite.so
#4 0x00007ffff7bd0f87 in kdemain () at /usr/lib64/libkdeinit5_kwrite.so
#5 0x00007ffff783db05 in __libc_start_main () at /lib64/libc.so.6
#6 0x00000000004007ee in _start ()
Thanks for testing.
Means applyMainWindowSettings() is also run w/o a real window (ie. restoreWindowSize() is noop)
Adjusted patch:
diff --git a/src/kmainwindow.cpp b/src/kmainwindow.cpp
index e273a76..d7f7442 100644
--- a/src/kmainwindow.cpp
+++ b/src/kmainwindow.cpp
@@ -608,7 +608,12 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg)
d->letDirtySettings = false;
if (!d->sizeApplied) {
+ winId(); // ensure there's a window created
KWindowConfig::restoreWindowSize(windowHandle(), cg);
+ // NOTICE: QWindow::setGeometry() does NOT impact the backing QWidget geometry even if the platform
+ // window was created -> QTBUG-40584. We therefore copy the size here.
+ // TODO: remove once this was resolved in QWidget QPA
+ resize(windowHandle()->size());
d->sizeApplied = true;
}
that's it! fixes the bug, and no segfaults now! (In reply to Hrvoje Senjan from comment #14) > that's it! fixes the bug, and no segfaults now! If you've already the Qt patch applied, simply creating the window handle (calling winId()) might be sufficient - evtl. accomplished by https://git.reviewboard.kde.org/r/119593/ ? patch review: https://git.reviewboard.kde.org/r/120078/ Git commit 1b9eed7738470ddfd495ded2e023aef6b8d079e5 by Thomas Lübking. Committed on 07/09/2014 at 10:56. Pushed by luebking into branch 'master'. fix kmainwindow size restorage, WA QTBUG 40584 This a) ensures there's windowaHandle() to restore the size for b) works around a pending Qt bug by explicitly coyping the restored QWindow size to the QWidget size REVIEW: 120078 M +6 -0 src/kmainwindow.cpp http://commits.kde.org/kxmlgui/1b9eed7738470ddfd495ded2e023aef6b8d079e5 |