Skip to content

Commit

Permalink
fix: drag and drop crash under loongson.
Browse files Browse the repository at this point in the history
Change-Id: I6773fbd63c758e91fe7828f18772b4ef5f17c208
  • Loading branch information
rekols committed Nov 6, 2018
1 parent 448792f commit 0dc5d62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ QMimeData* Tabbar::createMimeDataFromTab(int index, const QStyleOptionTab &optio
EditWrapper *wrapper = window->wrapper(fileAt(index));
QMimeData *mimeData = new QMimeData;

mimeData->setProperty("wrapper", QVariant::fromValue(static_cast<void *>(wrapper)));
mimeData->setData("dedit/tabbar", tabName.toUtf8());
mimeData->setUserData(0, (QObjectUserData *)wrapper);
mimeData->removeFormat("text/plain");

return mimeData;
Expand All @@ -245,7 +245,8 @@ void Tabbar::insertFromMimeDataOnDragEnter(int index, const QMimeData *source)
{
const QString tabName = QString::fromUtf8(source->data("dedit/tabbar"));

EditWrapper *wrapper = (EditWrapper *)source->userData(0);
QVariant pVar = source->property("wrapper");
EditWrapper *wrapper = static_cast<EditWrapper *>(pVar.value<void *>());
Window *window = static_cast<Window *>(this->window());

window->addTabWithWrapper(wrapper, wrapper->textEditor()->filepath, tabName, index);
Expand All @@ -256,7 +257,8 @@ void Tabbar::insertFromMimeData(int index, const QMimeData *source)
{
const QString tabName = QString::fromUtf8(source->data("dedit/tabbar"));

EditWrapper *wrapper = (EditWrapper *)source->userData(0);
QVariant pVar = source->property("wrapper");
EditWrapper *wrapper = static_cast<EditWrapper *>(pVar.value<void *>());
Window *window = static_cast<Window *>(this->window());

window->addTabWithWrapper(wrapper, wrapper->textEditor()->filepath, tabName, index);
Expand Down

0 comments on commit 0dc5d62

Please sign in to comment.