A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/42749093dc9adc2b31014edf78860ce65db30756 below:

Fix python upb crashes on map/repeated reference stub destructor · protocolbuffers/protobuf@4274909 · GitHub

@@ -685,8 +685,10 @@ static void PyUpb_Message_SyncSubobjs(PyUpb_Message* self);

685 685

* the set state (having a non-owning pointer to self->ptr.msg).

686 686

*/

687 687

static void PyUpb_Message_Reify(PyUpb_Message* self, const upb_FieldDef* f,

688 -

upb_Message* msg) {

688 +

upb_Message* msg, PyUpb_WeakMap* subobj_map,

689 +

intptr_t iter) {

689 690

assert(f == PyUpb_Message_GetFieldDef(self));

691 +

PyUpb_WeakMap_DeleteIter(subobj_map, &iter);

690 692

if (!msg) {

691 693

const upb_MessageDef* msgdef = PyUpb_Message_GetMsgdef((PyObject*)self);

692 694

const upb_MiniTable* layout = upb_MessageDef_MiniTable(msgdef);

@@ -738,17 +740,18 @@ static void PyUpb_Message_SyncSubobjs(PyUpb_Message* self) {

738 740

if (upb_FieldDef_HasPresence(f) && !upb_Message_HasFieldByDef(msg, f))

739 741

continue;

740 742

upb_MessageValue msgval = upb_Message_GetFieldByDef(msg, f);

741 -

PyUpb_WeakMap_DeleteIter(subobj_map, &iter);

742 743

if (upb_FieldDef_IsMap(f)) {

743 744

if (!msgval.map_val) continue;

744 -

PyUpb_MapContainer_Reify(obj, (upb_Map*)msgval.map_val);

745 +

PyUpb_MapContainer_Reify(obj, (upb_Map*)msgval.map_val, subobj_map, iter);

745 746

} else if (upb_FieldDef_IsRepeated(f)) {

746 747

if (!msgval.array_val) continue;

747 -

PyUpb_RepeatedContainer_Reify(obj, (upb_Array*)msgval.array_val);

748 +

PyUpb_RepeatedContainer_Reify(obj, (upb_Array*)msgval.array_val,

749 +

subobj_map, iter);

748 750

} else {

749 751

PyUpb_Message* sub = (void*)obj;

750 752

assert(self == sub->ptr.parent);

751 -

PyUpb_Message_Reify(sub, f, (upb_Message*)msgval.msg_val);

753 +

PyUpb_Message_Reify(sub, f, (upb_Message*)msgval.msg_val, subobj_map,

754 +

iter);

752 755

}

753 756

}

754 757

@@ -1404,18 +1407,17 @@ static PyObject* PyUpb_Message_Clear(PyUpb_Message* self) {

1404 1407 1405 1408

while (PyUpb_WeakMap_Next(subobj_map, &key, &obj, &iter)) {

1406 1409

const upb_FieldDef* f = key;

1407 -

PyUpb_WeakMap_DeleteIter(subobj_map, &iter);

1408 1410

if (upb_FieldDef_IsMap(f)) {

1409 1411

assert(upb_Message_GetFieldByDef(msg, f).map_val == NULL);

1410 -

PyUpb_MapContainer_Reify(obj, NULL);

1412 +

PyUpb_MapContainer_Reify(obj, NULL, subobj_map, iter);

1411 1413

} else if (upb_FieldDef_IsRepeated(f)) {

1412 1414

assert(upb_Message_GetFieldByDef(msg, f).array_val == NULL);

1413 -

PyUpb_RepeatedContainer_Reify(obj, NULL);

1415 +

PyUpb_RepeatedContainer_Reify(obj, NULL, subobj_map, iter);

1414 1416

} else {

1415 1417

assert(!upb_Message_HasFieldByDef(msg, f));

1416 1418

PyUpb_Message* sub = (void*)obj;

1417 1419

assert(self == sub->ptr.parent);

1418 -

PyUpb_Message_Reify(sub, f, NULL);

1420 +

PyUpb_Message_Reify(sub, f, NULL, subobj_map, iter);

1419 1421

}

1420 1422

}

1421 1423

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4