Review Request 126993: drkonqi : fix build errors and build nongui

René J.V. Bertin rjvbertin at gmail.com
Fri Feb 5 16:24:57 UTC 2016



> On Feb. 5, 2016, 3:57 p.m., Martin Gräßlin wrote:
> > drkonqi/drkonqi.cpp, lines 183-188
> > <https://git.reviewboard.kde.org/r/126993/diff/1/?file=442765#file442765line183>
> >
> >     yes this is possible and there is even a Krazy check for this. The QWeakPointer is the proper fix to this problem.
> >     
> >     What exactly was the compile issue you run into with the QWeakPointer?
> >     
> >     I assume that:
> >        QWeakPointer<QFileDialog> dlg(new QFileDialog(parent, defname));
> >     
> >     would solve your compile error.
> 
> Martin Gräßlin wrote:
>     found the explanation: https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0
> 
> René J.V. Bertin wrote:
>     Ah, yes, I have already seen similar situations where the possibiity of using the Quit menu on OS X was clearly something that the application didn't foresee. I must admit I have been shrugging that off.
>     
>     According to Frank's blog:
>     
>     ```
>     If was deleted during the exec(), exec() will return QDialog::Rejected.
>     ```
>     
>     Isn't that still the case? I was counting on it, and if it is true my modification should be fine (and have the advantage of being less complex). The code doesn't use `dlg` if `exec()` returned anything other than `QDialog::Accepted`.
>     
>     Also: DrKonqi doesn't seem to register on the DBus at all. At least not under its own name (there's just a ToDo note about implementing a proper DBus interface, who knows how old).
> 
> René J.V. Bertin wrote:
>     To answer the question: I don't have the exact error message anymore, but it was about an impossible assignment because of a missing ctor.
>     
>     As to your assumed fix: looks like it gives just about the same error as the original code did:
>     
>     ```
>     cd $build.dir && /usr/bin/c++   -DKCOREADDONS_LIB -DKDE_DEFAULT_DEBUG_AREA=1410 -DPROJECT_VERSION=\"5.5.4\" -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_X11EXTRAS_LIB -DQT_XML_LIB -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I<options> -isystem /opt/local/include/KF5/KI18n -isystem /opt/local/include/KF5 -isystem /opt/local/include/qt5 -isystem /opt/local/include/qt5/QtCore -isystem /opt/local/share/qt5/mkspecs/linux-g++-64 -isystem /opt/local/include/KF5/KCoreAddons -isystem /opt/local/include/KF5/KService -isystem /opt/local/include/KF5/KConfigCore -isystem /opt/local/include/KF5/KConfigWidgets -isystem /opt/local/include/KF5/KCodecs -isystem /opt/local/include/KF5/KWidgetsAddons -isystem /opt/local/include/qt5/QtWidgets -isystem /opt/local/include/qt5/QtGui -isystem /opt/local/include/KF5/KConfigGui -isystem /opt/local/include/qt5/QtXml -isystem /opt/local/include/KF5/KAuth -isystem /opt/local/include/KF5/KJobWidgets -isystem /opt/local/include/KF5/KIOCore -isystem /opt/local/include/KF5/KCrash -isystem /opt/local/include/KF5/KCompletion -isystem /opt/local/include/qt5/QtDBus -isystem /opt/local/include/KF5/KXmlRpcClient -isystem /opt/local/include/KF5/KXmlRpcClient/kxmlrpcclient -isystem /opt/local/include/KF5/KWallet -isystem /opt/local/include/qt5/QtX11Extras  -O3 -march=native -g -DNDEBUG  -std=c++0x -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type   -fPIC -o CMakeFiles/drkonqi.dir/drkonqi.cpp.o -c /.../plasma-workspace-5.5.4/drkonqi/drkonqi.cpp
>     /.../plasma-workspace-5.5.4/drkonqi/drkonqi.cpp:169:71: error: no matching function for call to ‘QWeakPointer<QFileDialog>::QWeakPointer(QFileDialog*)’
>              QWeakPointer<QFileDialog> dlg(new QFileDialog(parent, defname));
>                                                                            ^
>     In file included from /opt/local/include/qt5/QtCore/qsharedpointer.h:42:0,
>                      from /opt/local/include/qt5/QtCore/QWeakPointer:1,
>                      from /.../plasma-workspace-5.5.4/drkonqi/drkonqi.cpp:44:
>     /opt/local/include/qt5/QtCore/qsharedpointer_impl.h:696:12: note: candidate: template<class X> QWeakPointer<T>::QWeakPointer(X*, bool)
>          inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : 0), value(ptr)
>     <snip>
>     ```
> 
> Aleix Pol Gonzalez wrote:
>     Use QPointer.

QPointer<QFileDialog> . Yes, that seems to work.

Let's say that this code will be ready the day someone implements that org.kde.drkonqi service ...


- René J.V.


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126993/#review92090
-----------------------------------------------------------


On Feb. 5, 2016, 3:13 p.m., René J.V. Bertin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126993/
> -----------------------------------------------------------
> 
> (Updated Feb. 5, 2016, 3:13 p.m.)
> 
> 
> Review request for KDE Software on Mac OS X and Plasma.
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> While looking to build DrKonqi for OS X/MacPorts I came across a few issues that appear to be syntax/coding errors that, surprisingly, were never caught before given that they also caused compile failures when I used the same configure/build/packaging script on Linux.
> 
> The code uses methods that no longer exist in Qt 5.5+ : `QString::fromAscii()`, `QHeaderView::setResizeMod()` (replaced with `QHeaderView::setSectionResizeMode()` and `QInputDialog::getInteger()` (instead of `QInputDialog::getInt()`). Those are the easy and straightforward ones fixed by this patch.
> 
> The handling of file dialogs (in 2 locations) was more problematic. Both Apple's clang "6.0.0" and gcc 5.3 (on Linux) refused statements like `QWeakPointer<QFileDialog> dlg = new QFileDialog(parent,defname);` . My initial attempt was to follow the documentation for QWeakPointer, and do `QWeakPointer<QFileDialog> dlg = QSharedPointer<QFileDialog>(new QFileDialog(parent,defname));` but that caused a crash as soon as I clicked on the "save backtrace as" button - on both platforms.
> It turned out that `QSharedPointer<QFileDialog>()` returned a valid (non-null) shared pointer, but after creating a QWeakPointer from it, `dlg.data()` returned NULL -- immediately.
> 
> I had a look around in the 5.17.0 frameworks codebase, and could find no relevant examples of using QWeakPointer; some expressions appear to be equivalent to the original DrKonqi code, in other locations QWeakPointer instances are indeed created "going through" a QSharedPointer. In the end I tested using QFileDialog (and `QFileDialog::selectedUrls()` as kate5 does, and that works (on OS X and Linux).
> 
> That's what the attached patch does: no QFileDialog pointer at all, just an instance.
> This RR is intended to fuel a discussion on the subject, as suggested by Aleix; therefore I left the comment about the possibility of invalidating/deleting the file dialog e.g. through a DBus call. Is that actually a possibility, and why wouldn't it be in Kate? Are there no other ways to prevent it, or check for its occurrence?
> 
> This patch also marks drkonqi as a nongui executable, a requirement on OS X and which shouldn't cause any regressions elsewhere AFAIK.
> 
> 
> Diffs
> -----
> 
>   drkonqi/CMakeLists.txt deb8c40 
>   drkonqi/bugzillaintegration/bugzillalib.cpp 802c5fb 
>   drkonqi/bugzillaintegration/reportassistantpages_bugzilla.cpp e60fb14 
>   drkonqi/bugzillaintegration/reportassistantpages_bugzilla_duplicates.cpp 4f8f4ea 
>   drkonqi/drkonqi.cpp b12c118 
> 
> Diff: https://git.reviewboard.kde.org/r/126993/diff/
> 
> 
> Testing
> -------
> 
> On OS X 10.9.1 and Kubuntu 14.04, both with Qt 5.5.1 and KF5 5.17.0 installed into /opt/local
> 
> 
> Thanks,
> 
> René J.V. Bertin
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160205/ac2375c5/attachment-0001.html>


More information about the Plasma-devel mailing list