[QGIS-Developer] QgsProjectStyleSettings styles.db remain open after QgsProject::clear()

Radim Blazek radim.blazek at gmail.com
Tue Jun 6 09:08:24 PDT 2023


On Tue, Apr 18, 2023 at 10:38 AM Nyall Dawson <nyall.dawson at gmail.com> wrote:
> You can safely execute the event loop with DeferredDelete to only cleanup of this object without the danger of other event loop mess.

Can you point me how to do it?

Radim

On Tue, Apr 18, 2023 at 10:38 AM Nyall Dawson <nyall.dawson at gmail.com> wrote:
>> 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.


More information about the QGIS-Developer mailing list