Review Request 118994: make CTRL+SHIFT+T reopen last closed tab

Thomas Lübking thomas.luebking at gmail.com
Sun Jul 6 11:57:04 BST 2014



> On Juli 5, 2014, 11:36 vorm., Arjun Ak wrote:
> > dolphin/src/dolphinrecenttabsmenu.cpp, line 102
> > <https://git.reviewboard.kde.org/r/118994/diff/5/?file=287351#file287351line102>
> >
> >     Is it safe to 'delete' a QObject? shouldnt we be using deleteLater()

There's no general rule.
Deleting a QObject is as un/safe as deleting anything else.

You must ensure that the referenced memory is not used afterwards, what makes deleting "stuff" in eventfilters and slots "risky" unless you suck the event (return true) or queue the slot/know that the emitting code is safe against lossing "this" object (ie. it's a "special" problem if you connect to an objects signal and delete that very object from the slot if the emitting code does not return after the emit but tries to access members)
This does however hold for every other non-local heap structure (ie. if you delete away an objects member w/o the object noticing it, you cause a dangeling member pointer)

::deleteLater() bypasses *some* problems, but is no bullet proof deletion.
Eg. the code around the patch sets the local action pointer "0", what is completely pointless (and makes me worry somebody did sth. w/o any idea /what/ he's doing ;-)


If you need protection against randomly deleted objects, you've to use a "smart" pointer (QPointer) and then test whether the pointer ::isNull() if you're unsure about the objects state.


- Thomas


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


On Juli 6, 2014, 10:46 vorm., Arjun Ak wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118994/
> -----------------------------------------------------------
> 
> (Updated Juli 6, 2014, 10:46 vorm.)
> 
> 
> Review request for Dolphin and KDE Base Apps.
> 
> 
> Bugs: 336818
>     http://bugs.kde.org/show_bug.cgi?id=336818
> 
> 
> Repository: kde-baseapps
> 
> 
> Description
> -------
> 
> Upon pressing CTRL+SHIFT+T, the most recently closed tab is reopened (with the help of Go->'Recently closed tabs' menu).
> 
> 
> Diffs
> -----
> 
>   dolphin/src/dolphinmainwindow.h 7c3bff4 
>   dolphin/src/dolphinmainwindow.cpp d9fe645 
>   dolphin/src/dolphinrecenttabsmenu.h 34d4153 
>   dolphin/src/dolphinrecenttabsmenu.cpp a39f994 
>   dolphin/src/dolphinui.rc 52826bb 
> 
> Diff: https://git.reviewboard.kde.org/r/118994/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Arjun Ak
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20140706/7c480746/attachment.htm>


More information about the kfm-devel mailing list