Fixing another instance of bug 8227.

This commit is contained in:
zuperdee%penguinpowered.com 1999-07-21 19:49:13 +00:00
parent d0b9b7330f
commit cbd1d1b871

View File

@ -22,6 +22,7 @@
#include <Xm/RowColumn.h>
#include "resources.h"
#include "nsMotifMenu.h"
#include "nsError.h" // For NS_ERROR_OUT_OF_MEMORY.
#include "stdio.h"
@ -34,17 +35,14 @@
//==============================================================
void nsXtWidget_Menu_Callback(Widget w, XtPointer p, XtPointer call_data)
{
MenuCallbackStruct * cbs = (MenuCallbackStruct *)p;
if (cbs != NULL) {
MenuCallbackProc cb = (MenuCallbackProc)call_data;
if (cbs->mCallback != NULL) {
(*cbs->mCallback)(cbs->mId);
}
}
}
//-----------------------------------------------------
Widget CreatePulldownMenu(Widget aParent,
char * aMenuTitle,
@ -82,8 +80,11 @@ Widget CreateMenuItem(Widget aParent,
NULL);
MenuCallbackStruct * cbs = new MenuCallbackStruct();
cbs->mCallback = aCallback;
cbs->mId = aID;
if (cbs) {
cbs->mCallback = aCallback;
cbs->mId = aID;
}
else cbs = (MenuCallbackStruct *)NS_ERROR_OUT_OF_MEMORY;
XtAddCallback(widget, XmNactivateCallback, nsXtWidget_Menu_Callback, cbs);