On Tue, 18 Apr 2023, 6:34 pm Radim Blazek via QGIS-Developer, <
qgis-developer@lists.osgeo.org> wrote:

> Hi,
> with Qgis 3.28.3 called from Python, whenever QgsProject::clear() is
> called it creates new styles.db file, previous styles file is deleted
> from system, but it remains open (listed by lsof). It becomes a
> problem in server environment where every call to QgsProject::clear()
> creates a new file and limit of open files is soon reached.
>
> Just reading the code I was not able to trace down where / which
> object remains referenced. Maybe QgsStyle.mCurrentDB should be closed
> explicitly?
>

It will only get freed when the event loop is next executed.

You can safely execute the event loop with DeferredDelete to only cleanup
of this object without the danger of other event loop mess.

Nyall


> Is it OK to use this workaround?:
> project = QgsProject(None, Qgis.ProjectCapabilities())
> QgsProject.setInstance(project)
>
> BTW, how can I modify QgsProject.capabilities() from Python?
>
> Radim
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to