Skip to content

有多进程调用时,会重复启动Qt主窗口直到内存耗尽 #21

@rockswang

Description

@rockswang

入口代码如下,开头会先启动一个后台进程。
python 直接执行正常,通过PyStand.exe 启动,就会不断启动Qt窗口,直到内存耗尽为止。
PyInstaller也有类似问题,按照PyInstaller的方案,加上了freeze_support(),但是问题依旧。
是否需要在PyStand.exe的主程序里添加此调用?

if "__main__" == __name__:
    multiprocessing.freeze_support()
    multiprocessing.Process(target=VideoServer.start_server, daemon=True).start()

    logger.info("启动程序")
    app = QApplication(sys.argv)
    app.setStyleSheet(BASE_STYLE_SHEET)
    win = AppWin(sys.argv)
    win.show()
    sys.exit(app.exec())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions