Forums WoW Modding Support Archives WoWModding Support Archives [DiscordArchive] <@160857905879449600> <@100246412050075648> do you guys know if QT handles stuff created on heap aut

[DiscordArchive] <@160857905879449600> <@100246412050075648> do you guys know if QT handles stuff created on heap aut

[DiscordArchive] <@160857905879449600> <@100246412050075648> do you guys know if QT handles stuff created on heap aut

Pages (3): 1 2 3 Next
rektbyfaith
Administrator
0
06-06-2019, 05:36 PM
#1
Archived author: Skarn • Posted: 2019-06-06T17:36:47.573000+00:00
Original source

<@160857905879449600> <@100246412050075648> do you guys know if QT handles stuff created on heap automatically or I have to manually remove it?
rektbyfaith
06-06-2019, 05:36 PM #1

Archived author: Skarn • Posted: 2019-06-06T17:36:47.573000+00:00
Original source

<@160857905879449600> <@100246412050075648> do you guys know if QT handles stuff created on heap automatically or I have to manually remove it?

rektbyfaith
Administrator
0
06-06-2019, 05:36 PM
#2
Archived author: Skarn • Posted: 2019-06-06T17:36:52.776000+00:00
Original source

I don't see it being removed anywhere
rektbyfaith
06-06-2019, 05:36 PM #2

Archived author: Skarn • Posted: 2019-06-06T17:36:52.776000+00:00
Original source

I don't see it being removed anywhere

rektbyfaith
Administrator
0
06-06-2019, 05:37 PM
#3
Archived author: Skarn • Posted: 2019-06-06T17:37:02.649000+00:00
Original source

but from what I know you need to explicitly delete that stuff to avoid memory leaks
rektbyfaith
06-06-2019, 05:37 PM #3

Archived author: Skarn • Posted: 2019-06-06T17:37:02.649000+00:00
Original source

but from what I know you need to explicitly delete that stuff to avoid memory leaks

rektbyfaith
Administrator
0
06-06-2019, 05:38 PM
#4
Archived author: schlumpf • Posted: 2019-06-06T17:38:37.382000+00:00
Original source

That’s what I told you about earlier with the QObject memory model where parents delete all their children when they are deleted
rektbyfaith
06-06-2019, 05:38 PM #4

Archived author: schlumpf • Posted: 2019-06-06T17:38:37.382000+00:00
Original source

That’s what I told you about earlier with the QObject memory model where parents delete all their children when they are deleted

rektbyfaith
Administrator
0
06-06-2019, 05:38 PM
#5
Archived author: Skarn • Posted: 2019-06-06T17:38:38.381000+00:00
Original source

```cpp
void TextureList::mousePressEvent(QMouseEvent* event)
{
QListView::mousePressEvent(event);

if (event->buttons() & Qt::LeftButton) {
int distance = (event->pos() - _start_pos).manhattanLength();
if (distance >= QApplication:ConfusedtartDragDistance())
{
QModelIndex index = currentIndex();
const std:Confusedtring filename = index.data(Qt:Big GrinisplayRole).toString().prepend("tileset/").toStdString();

QMimeData* mimeData = new QMimeData;
mimeData->setText(QString(filename.c_str()));


QDrag* drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->exec();
}
}
}
```
rektbyfaith
06-06-2019, 05:38 PM #5

Archived author: Skarn • Posted: 2019-06-06T17:38:38.381000+00:00
Original source

```cpp
void TextureList::mousePressEvent(QMouseEvent* event)
{
QListView::mousePressEvent(event);

if (event->buttons() & Qt::LeftButton) {
int distance = (event->pos() - _start_pos).manhattanLength();
if (distance >= QApplication:ConfusedtartDragDistance())
{
QModelIndex index = currentIndex();
const std:Confusedtring filename = index.data(Qt:Big GrinisplayRole).toString().prepend("tileset/").toStdString();

QMimeData* mimeData = new QMimeData;
mimeData->setText(QString(filename.c_str()));


QDrag* drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->exec();
}
}
}
```

rektbyfaith
Administrator
0
06-06-2019, 05:38 PM
#6
Archived author: Skarn • Posted: 2019-06-06T17:38:49.899000+00:00
Original source

e.g. is this code leaking or not?
rektbyfaith
06-06-2019, 05:38 PM #6

Archived author: Skarn • Posted: 2019-06-06T17:38:49.899000+00:00
Original source

e.g. is this code leaking or not?

rektbyfaith
Administrator
0
06-06-2019, 05:39 PM
#7
Archived author: Skarn • Posted: 2019-06-06T17:39:25.333000+00:00
Original source

<@160857905879449600> I undertstand the parent - children part. But what about non-widget types?
rektbyfaith
06-06-2019, 05:39 PM #7

Archived author: Skarn • Posted: 2019-06-06T17:39:25.333000+00:00
Original source

<@160857905879449600> I undertstand the parent - children part. But what about non-widget types?

rektbyfaith
Administrator
0
06-06-2019, 05:40 PM
#8
Archived author: schlumpf • Posted: 2019-06-06T17:40:55.559000+00:00
Original source

Event: owned by qt.
Mimedata: no parent set until added to drag which takes ownership as documented, so may leak when an exception is thrown between those two lines
Drag: the object passed into the ctor is awkwardly documented but takes ownership.
rektbyfaith
06-06-2019, 05:40 PM #8

Archived author: schlumpf • Posted: 2019-06-06T17:40:55.559000+00:00
Original source

Event: owned by qt.
Mimedata: no parent set until added to drag which takes ownership as documented, so may leak when an exception is thrown between those two lines
Drag: the object passed into the ctor is awkwardly documented but takes ownership.

rektbyfaith
Administrator
0
06-06-2019, 05:41 PM
#9
Archived author: schlumpf • Posted: 2019-06-06T17:41:12.098000+00:00
Original source

In an exceptionless world that code does not leak.
rektbyfaith
06-06-2019, 05:41 PM #9

Archived author: schlumpf • Posted: 2019-06-06T17:41:12.098000+00:00
Original source

In an exceptionless world that code does not leak.

rektbyfaith
Administrator
0
06-06-2019, 05:41 PM
#10
Archived author: schlumpf • Posted: 2019-06-06T17:41:23.851000+00:00
Original source

QObject is not just widgets
rektbyfaith
06-06-2019, 05:41 PM #10

Archived author: schlumpf • Posted: 2019-06-06T17:41:23.851000+00:00
Original source

QObject is not just widgets

Pages (3): 1 2 3 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)