Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#301 closed bug (invalid)

Crash in MUIP_DupText ?

Reported by: Guillaume Boesel Owned by:
Priority: normal Milestone: 4.0-2016R2
Component: muimaster.library Version: 4.0-2016R1
Severity: minor Keywords:
Cc: OS Platform: AmigaOS4
Blocked By: Blocking:
Release Notes:

Description

Summary

Hi,
trying to insert records in a NList from a child process (CreateNewProcTags) with

DoMethod(app,MUIM_Application_PushMethod,

LV_Fichiers_NList,3,MUIM_NList_InsertSingle, &ent, MUIV_NList_Insert_Bottom);

sometimes crashs my program with

Stack trace:

native kernel module newlib.library.kmod+0x0002fed8
MUIP_Duptext()+0xb4 (section 1 @ 0x13A2C)
native kernel module intuition.library.kmod+0x00020da8
native kernel module intuition.library.kmod+0x00020f4c
native kernel module intuition.library.kmod+0x00021228
native kernel module intuition.library.kmod+0x00009b34
native kernel module intuition.library.kmod+0x00009dd4
NotifyDispatcher()+0x2a0 (section 1 @ 0x63E6C)
native kernel module intuition.library.kmod+0x00020da8
native kernel module intuition.library.kmod+0x00020f4c
native kernel module intuition.library.kmod+0x00009efc
AreaDispatcher()+0xc88 (section 1 @ 0x359F4)
native kernel module intuition.library.kmod+0x00020da8
native kernel module intuition.library.kmod+0x00020f4c
native kernel module intuition.library.kmod+0x00009efc
TextDispatcher()+0xdc (section 1 @ 0x75B70)
native kernel module intuition.library.kmod+0x00020da8
native kernel module intuition.library.kmod+0x00020f4c
native kernel module intuition.library.kmod+0x0000a044
m_Application_NewInput()+0xc28 (section 1 @ 0x289AC)
ApplicationDispatcher()+0x18d4 (section 1 @ 0x2CF68)

Could you give me an advice about this error. What can be the cause of this MUIP_Duptext() problem in my program ?

Thank you by advance.
Guillaume

Attachments (1)

Crashlog_FastView_2016-04-05_23-25-02.txt (35.9 KB) - added by Guillaume Boesel 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 50 years ago by Guillaume Boesel

Status: pendingnew

Changed 4 years ago by Guillaume Boesel

comment:1 Changed 4 years ago by Thore Böckelmann

Component: undefinedmuimaster.library
Milestone: future release4.0-2016R2
Priority: undecidednormal
Status: newpending

You gave the cause of the crash yourself already. It is how you insert the new entry into the list:

 DoMethod(app,MUIM_Application_PushMethod,
    LV_Fichiers_NList,3,MUIM_NList_InsertSingle, &ent, MUIV_NList_Insert_Bottom);

I suppose "ent" is a local variable of one of your child process's functions containing the data to be inserted. You must keep in mind that this variable most probably does not exist anymore (i.e. the pushing function is left or the child process terminated in the meantime) at the time when MUIM_Application_PushMethod eventually executes the pushed MUIM_NList_InsertSingle method. That's what is causing the crash.

MUIP_Duptext() is a private function of muimaster.library to duplicate a text string. I cannot tell why it occurs in the stack trace, but I guess it just happens to end up there because of stale pointers and hence wrong functions being called as described above.

If you want to push methods like this for deferred execution you must ensure that the parameters and their contents stay valid until the pushed method is eventually executed.

In YAM we implemented a "method stack" for synchronous and asynchronous execution of methods from child processes: MethodStack.c. I think you will need something similar for your application.

comment:2 Changed 4 years ago by Guillaume Boesel

Thank you for your explanation. I thought (I don't know why…) that PushMethod waited that the Method was completed before to exit.

comment:3 Changed 4 years ago by Thore Böckelmann

Resolution: invalid
Status: newclosed

No. PushMethod must be asynchronous. It can even be called from the application's main task. Imagine it would be synchronous in that situation…

comment:4 Changed 4 years ago by Guillaume Boesel

Ah OK, right.

Note: See TracTickets for help on using tickets.