Page MenuHomePhabricator

Crash when drag-and-dropping data node on Win64
Closed, ResolvedPublic

Description

Our viewer crashes when we drag a data node from the data manager and drop it on a QmitkRenderWindow.

This happens on 64 bit windows. The app was built with VS2012.

The bug is in QmitkDataStorageTreeModel.cpp and QmitkRenderWindow.cpp. The data node pointers are converted to void* then to long, then the long values are concatenated to a string, with comma delimiter. The QmitkRenderWindow restores the pointers from the string when it processes the QDropEvent.

On this platform, however, sizeof(void*) is 8 and sizeof(long) is 4, and some significant bits are lost during the conversion.

The solution is to use unsigned long everywhere.

I will send a pull request that fixes the problem in the two classes I mentioned. You might want to check if a drop event is constructed or processed at other places in MITK.

Event Timeline

Any update on this?
We have been using the fix for a while now, it's tested on the three main platforms.
I'm trying to minimise the number of open tickets, and this seems to be an easy one.
Thanks.

17828 is another duplicate.

Could this be fixed for the upcoming release, possibly?

Now three patches are provided. :-)

Thanks!

I assume T17795 is another duplicate of this bug. I will mark them as duplicate if the patch fixes the mentioned problems as well.

User goch has pushed new remote branch:

bug-17534-fix-64-bit-pointer-crash

We decided to redesign the mime type handling somewhat. We no longer store the node/tree item pointers as comma separated ascii which is split into a string list to be read, instead we stream them directly into the byte array.

This way we do not need to use Qt's conversion to Long or LongLong, but can instead use quintptrs, which should always have the appropriate size for each platform.

The pushed branch also includes a merge of T18025.

Miklos, can you verify that this resolves your problem? I have not seen any crashes so far.

[e962c1]: Merge branch 'bug-17534-fix-64-bit-pointer-crash'

Merged commits:

2014-09-24 12:28:02 Caspar Goch [7620c5]
Merge remote-tracking branch 'origin/bug-18025-Fix-Invalidation-FilterModel' into bug-17543-64-bit-pointer-crash


2014-09-24 11:09:23 Caspar Goch [b49c5e]
Implemented 64 bit address handling of treeitems and nodes

Added new QMITK Mime types and functions for encoding/decoding the
addresses. The current system still exists and will work but has been
declared deprecated and will be removed at a future time

Removed debug output

I just tested it, and it works well now.
Thank you!

Great, then I consider this issue closed

[54d2a8]: Merge branch 'bug-17534-fix-64-bit-pointer-crash'

Merged commits:

2014-09-26 17:04:35 Eric Heim [f36dd1]
added missing dependency to QtWidgets