Impossible to invoke a message inside of a timer app? (make blender 2.8 crash)

impossible for me to incoke a message within a timer app? is it normal? is it a bug? should i repport it ?
for this message system:

import bpy 

def ShowMessageBox(message = "", title = "Message Box", icon = 'INFO'): #Message function
    def draw(self, context):
        self.layout.label(text=message)
    bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
    
ShowMessageBox("Such crash", "Many Wow" ,"BLENDER")
import bpy 

def ShowMessageBox(message = "", title = "Message Box", icon = 'INFO'): #Message function
    def draw(self, context):
        self.layout.label(text=message)
    bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
    
def every_X_seconds_word():
    ShowMessageBox("Hello World", "Many Wow" ,"BLENDER")
    return 5.0
bpy.app.timers.register(every_X_seconds_word)

this make blender crash

import bpy 

def every_X_seconds_word():
    def ShowMessageBox(message = "", title = "Message Box", icon = 'INFO'): #Message function
        def draw(self, context):
            self.layout.label(text=message)
        bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
    ShowMessageBox("Hello World", "Many Wow" ,"BLENDER")
    return 5.0
bpy.app.timers.register(every_X_seconds_word)

i tried within the app, also crash.

maybe it can work with another messaging system? i don’t know any other, i tried to invoke a message from the status bar, didn’t find anything on how to do that :frowning:

any news on why it cause blender to crash ?

I couldn’t tell you the specific reason without building from source and running your script with the debugger, but you’re getting an access violation crash. something in your script is trying to access data that no longer exists, or is in a new location (broken pointer)

1 Like

thanks for this answer

i asked here, if someone know how to override context.wm and draw(self, context):
https://developer.blender.org/T62051